二。使用$[ ]或$(())表达式
[root@pangdanet ~]# x=1234
[root@pangdanet ~]# echo $[x+78]
1312
[root@pangdanet ~]# echo $[x-78]
1156
[root@pangdanet ~]# echo $[x*78]
96252
[root@pangdanet ~]# echo $[x/78]
15
[root@pangdanet ~]# echo $[x%78]
64
三。使用let命令
[root@2015idc ~]# x=1234
[root@2015idc ~]# let y=x+22
[root@2015idc ~]# echo $y
1256
[root@2015idc ~]# let x+=78;echo $x # x+=78(x=x+78)
1312
[root@2015idc ~]# let x-=78;echo $x # x-=78(x=x-78)
1234
[root@2015idc ~]# let x=78;echo $x # x=78(x=x*78)
96252
[root@2015idc ~]# let x/=78;echo $x # x/=78(x=x/78)
1234
[root@2015idc ~]# let x%=78; echo $x # x%=78(x=x%79)
64
未完,待续
原文:http://blog.51cto.com/20214843/2071215