bash: Arithmetic Expansion
1
1 3.5.5 Arithmetic Expansion
1 --------------------------
1
1 Arithmetic expansion allows the evaluation of an arithmetic expression
1 and the substitution of the result. The format for arithmetic expansion
1 is:
1
1 $(( EXPRESSION ))
1
1 The expression is treated as if it were within double quotes, but a
1 double quote inside the parentheses is not treated specially. All
1 tokens in the expression undergo parameter and variable expansion,
1 command substitution, and quote removal. The result is treated as the
1 arithmetic expression to be evaluated. Arithmetic expansions may be
1 nested.
1
1 The evaluation is performed according to the rules listed below
1 (⇒Shell Arithmetic). If the expression is invalid, Bash prints a
1 message indicating failure to the standard error and no substitution
1 occurs.
1