linux shell 数值计算let和expr

74 阅读1分钟

Shell脚本中 整数运算一般通过 let 和 expr 这两个指令来实现,如对变量 s 加 1 可以写作:let ++s 或者 s=`expr $s + 1‘

 

可以看出let比expr要快速的多