The expr command is used mostly for integer values, but can be used for strings as well. Its general format is:
expr argument operator argument
Expr is a handy command line calculator as well:
$ expr 10 + 10 20 $ expr 900 + 600 1500 $ expr 30 / 3 10 $ expr 30 / 3 /2 5
When using the multiply sign, you will have to escape it with a backslash, because the shell might misinterpret the asterisk ‘*’:
$ expr 30 \* 3 90
Expr does the incrementing of values when using loops. First the loop is initialized to zero. Then one is added to the variable loop. The use of the quotes means command substitution, which basically means take the output from the command (expr) and put it in the variable loop.
$ LOOP=0 ...