shell 计算

1、整数计算

1  n=$((20/7))
2  echo $n 

输出 2(注意必须是两个括号)

exper 20 / 5 / 3

注意这里不支持括号,a%b,a/b后取余

output: 1

2、小数计算

 1 bc <<< 'scale=4;20+5/2' 

输出22.5000  

awk"BEGIN {print (20+5)/3}"

output: 8.33333

calc 6/3.2

output:1.2

3、三角函数等特殊计算

原文地址:https://www.cnblogs.com/shixun/p/6146242.html