Evaluate arithmetic expressions.
Evaluate each ARG as an arithmetic expression. Evaluation is done in
fixed-width integers with no check for overflow, though division by 0
is trapped and flagged as an error. The following list of operators is
grouped into levels of equal-precedence operators. The levels are listed
in order of decreasing precedence.
[tab]
id++, id--
[tab]
variable post-increment, post-decrement
[tab]
++id, --id
[tab]
variable pre-increment, pre-decrement
[tab]
-, +
[tab]
[tab]
unary minus, plus
[tab]
!, ~
[tab]
[tab]
logical and bitwise negation
[tab]
**
[tab]
[tab]
exponentiation
[tab]
*, /, %
[tab]
[tab]
multiplication, division, remainder
[tab]
+, -
[tab]
[tab]
addition, subtraction
[tab]
<<, >>
[tab]
[tab]
left and right bitwise shifts
[tab]
<=, >=, <, >
[tab]
comparison
[tab]
==, !=
[tab]
[tab]
equality, inequality
[tab]
&
[tab]
[tab]
bitwise AND
[tab]
^
[tab]
[tab]
bitwise XOR
[tab]
|
[tab]
[tab]
bitwise OR
[tab]
&&
[tab]
[tab]
logical AND
[tab]
||
[tab]
[tab]
logical OR
[tab]
expr ? expr : expr
[tab]
[tab]
[tab]
conditional operator
[tab]
=, *=, /=, %=,
[tab]
+=, -=, <<=, >>=,
[tab]
&=, ^=, |=
[tab]
assignment
Shell variables are allowed as operands. The name of the variable
is replaced by its value (coerced to a fixed-width integer) within
an expression. The variable need not have its integer attribute
turned on to be used in an expression.
Operators are evaluated in order of precedence. Sub-expressions in
parentheses are evaluated first and may override the precedence
rules above.
Exit Status:
If the last ARG evaluates to 0, let returns 1; let returns 0 otherwise.