Arithmetic
Use $(( )) for integer maths. Bash has no floats, use bc or awk for decimals.
Example
a=7; b=2
echo $((a + b)) $((a / b)) $((a % b)) $((a ** 3))
((a++))
echo $a
echo "scale=2; 7/2" | bcResult
9 3 1 343 8 3.50
Exercise
Integer math.
echo $((a b))
Quiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.