expr

Evaluates an expression

expr expression

The expr utility evaluates an expression and displays the result. The utility evaluates character strings that represent either numeric or nonnumeric values. Operators are used with the strings to form expressions.

Arguments

The expression is composed of strings with operators in between. Each string and operator constitute a distinct argument that you must separate from other arguments with a SPACE. You must quote operators that have special meanings to the shell (for example, the multiplication operator, *).

The following list of expr operators is in order of decreasing precedence. Each group of operators has the same precedence. You can change the order of evaluation with parentheses.

:

comparison ...

Get A Practical Guide to Red Hat® Linux® 8 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.