shell计算的总结
[email protected]:~# A=123 [email protected]:~# B=234
1、let
[email protected]:~# let C=$A+$B [email protected]:~# echo $C 357
2、$[]
[email protected]:~# D=$[$A+$B] [email protected]:~# echo $D 357
3、$(())
[email protected]:~# E=$(($A+$B)) [email protected]:~# echo $E 357
4、expr
[email protected]:~# F=`expr $A + $B` [email protected]:~# echo $F 357
5、bc
[email protected]:~# echo $A+$B|bc 357
时间: 2024-11-09 00:12:20