Bash Bash Arithmetic Simple arithmetic with (( ))


Example

#!/bin/bash
echo $(( 1 + 2 ))

Output: 3

# Using variables
#!/bin/bash
var1=4
var2=5
((output=$var1 * $var2))
printf "%d\n" "$output"

Output: 20