Math using bash capabilities
suggest changeArithmetic can also be done without calling another program:
Multiplication:
echo $((5 * 2))
10
Division (integer division; the fractional part is discarded):
echo $((5 / 2))
2
Modulo:
echo $((5 % 2))
1
Exponentiation:
echo $((5 ** 2))
25
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents