bash-completion包:支持tab补齐
数值运算:整数运算、小数运算 一、整数运算 1、expr expr A + B,A和B之间要空格,否则直接显示A+B expr A - B expr A * B #乘法*需要采用转义*,避免被作为shell通配符 expr A / B :只能屏蔽一个字符e.g: [root@shell ~]# a=24 [root@shell ~]# echo $a $a [root@shell ~]# echo $a 24 [root@shell ~]# echo $a$b $a [root@shell ~]# echo $a$b $a$b
2、$[]或$(()) 举例: [root@shell ~]# echo $[10*3] 30 [root@shell ~]# echo $[10/3] 3 [root@shell ~]# echo $[10+3] 13 [root@shell ~]# echo $[10-3] 7 [root@shell ~]# echo $[10%3] 1 [root@shell ~]# x=3 [root@shell ~]# y=5 [root@shell ~]# echo $[x+y] 8
可以一行进行多个运算 [root@shell ~]# x=8 [root@shell ~]# echo $[x+8],$[x*8] [root@shell ~]# 16,64
3、let运算 不回显结果 [root@shell ~]# x=9 [root@shell ~]# let x=x+8 [root@shell ~]# echo $x 17
4、特殊用法: i=n let i++ ---->i=n+1 let i-- ---->i=n-1 let i+=3 --->i=n+3 let i-=2 --->i=n-2 let i*=2 --->i=n2 let i/=2 --->i=n/2 举例: [root@shell ~]# i=24 [root@shell ~]# let i++ [root@shell ~]# echo $i 25 [root@shell ~]# let i+=3 [root@shell ~]# echo $i 28 [root@shell ~]# let i-=1 [root@shell ~]# echo $i 27 [root@shell ~]# let i=2 [root&#