let

letor ((`expressions`

))`expressions`

Perform arithmetic as specified by one or more
*expressions*. *expressions*
consist of numbers, operators, and shell variables (which don’t need
a preceding **$**). Expressions must
be quoted if they contain spaces or other special characters. The
**(( ))** form does the quoting for
you. For more information and examples, see Arithmetic Expressions in Arithmetic Expressions. See also **expr** in Chapter 3.

Each of these examples adds 1 to variable **i**:

i=`expr $i + 1` let i=i+1 let "i = i + 1" (( i = i + 1 )) (( i += 1 )) (( i++ ))

Start Free Trial

No credit card required