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"`

  http://unix.stackexchange.com/a/93030

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-10-27
  • 2021-09-18
  • 2021-06-19
猜你喜欢
  • 2021-08-28
  • 2022-12-23
  • 2021-09-20
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案