GNU Info

Info Node: (sh-utils.info)expr invocation

(sh-utils.info)expr invocation


Prev: test invocation Up: Conditions
Enter node , (file) or (file)node

`expr': Evaluate expressions
============================

   `expr' evaluates an expression and writes the result on standard
output.  Each token of the expression must be a separate argument.

   Operands are either numbers or strings.  `expr' converts anything
appearing in an operand position to an integer or a string depending on
the operation being applied to it.

   Strings are not quoted for `expr' itself, though you may need to
quote them to protect characters with special meaning to the shell,
e.g., spaces.

   Operators may given as infix symbols or prefix keywords.  Parentheses
may be used for grouping in the usual manner (you must quote parentheses
to avoid the shell evaluating them, however).

   Exit status:

     0 if the expression is neither null nor 0,
     1 if the expression is null or 0,
     2 for invalid expressions.

String expressions
<colon> match substr index length quote
Numeric expressions
+ - * / %
Relations for expr
| & < <= = == != >= >
Examples of expr
Examples.

automatically generated by info2www version 1.2.2.9