Bash arithmetic

Bash arithmetic expansion provides a powerful tool for performing arithmetic operations in scripts. Translating a string into a numerical expression is relatively straightforward using backticks (`), double parentheses (( )), or let.

Example 1: #

Press + to interact
i=1
i=`expr $i + 1`
echo $i

Where, expr is an all-purpose expression evaluator.

Example 2: #

Press + to interact
i=1
j=$(( i+1 ))
echo $j

An example consisting of let

Example 3: #

Press + to interact
let i=3+5
echo "3 + 5 =" $i

Order of Precedence ...