命令介绍
1、expr 命令
[root@localhost shell]# a=1
[root@localhost shell]# b=2
[root@localhost shell]# expr $a + $b
3
[root@localhost shell]# expr $a - $b
-1
[root@localhost shell]# expr $a \* $b
2
[root@localhost shell]# expr $b / $a
2
2、let 命令
[root@localhost shell]# c=4
[root@localhost shell]# let d=c+4
[root@localhost shell]# echo $d
8
3、内置命令 双括号
[root@localhost shell]# echo $((1+7)) ##不支持小数计算
[root@localhost shell]# echo $[7+8]
15
本文出自 “sdsca” 博客,请务必保留此出处http://sdsca.blog.51cto.com/10852974/1890831
原文:http://sdsca.blog.51cto.com/10852974/1890831