BashBash Arithmetic


Syntax

  • $(( EXPRESSION )) - Evaluates expression and returns its result.

  • expr EXPRESSION - Prints result of EXPRESSION to stdout.

Parameters

ParameterDetails
EXPRESSIONExpression to evaluate

Remarks

A space (" ") is required between each term (or sign) of the expression. "1+2" won't work, but "1 + 2" will work.