Table lists the dollar bracket expressions that allow arithmetic operations. The summation operator ${+ } simply adds up all arguments and returns a string containing the total sum. Similarly, the multiplication operator multiplies all arguments as returns the total product.
The subtraction operator subtracts all arguments after the first argument from the first argument, i.e.
x = ${- 100 50 4 2} y = ${/ 12 2 3}assigns the value 45 to the variable x. Similarly, the division operator divides the first argument by all following arguments. Variable y therefore carries the value 2 after parsing.
${+ arg1 arg2 arg3 ...} | plus |
${* arg1 arg2 arg3 ...} | multiplication |
${- arg1 arg2 arg3 ...} | subtraction |
${/ arg1 arg2 arg3 ...} | division |
${^ arg1 arg2 arg3 ...} | power |