Arithmetic in bash is done with $ and double parentheses:
echo "$(($num1+$num2))"
Or $ and square brackets:
echo "$[$num1+$num2]"
You can assign from that (sans echo). There is also expr:
echo `expr "$num1" + "$num2"`
转载于:https://www.cnblogs.com/long123king/p/3833046.html