bash sum variables code example
Example 1: sum variables shell
a=`expr "$a" + "$num"`
a=$(($a+$num))
((a=a+num))
let a=a+num
((a+=num))
Example 2: bash sum variable
x = 2
y = 2
echo $((x + y))
a=`expr "$a" + "$num"`
a=$(($a+$num))
((a=a+num))
let a=a+num
((a+=num))
x = 2
y = 2
echo $((x + y))