1、运算
使用双引号可以引用除字符$、·、\外的任何字符和字符串
abc abc.txt anaconda-ks.cfg cal.txt Desktop find.sh install.log install.log.syslog
[root@oracle11g ~]# echo * //只显示文件, 不包含目录
abc abc.txt anaconda-ks.cfg cal.txt Desktop find.sh install.log install.log.syslog
[root@oracle11g ~]# echo $[ 2+8 ]
10
[root@oracle11g ~]# echo $[2+8]
10
[root@oracle11g ~]# echo $[ 2>>8 ] //将2向右移8位,左边补0
0
[root@oracle11g ~]# echo $[ 2<<4 ] //将2向左移4位,右边补0
32
[root@oracle11g ~]# echo $[ 2^4 ] //异或运算
6
[root@oracle11g ~]# echo $[ 2 | 4 ] //或运算
6
[root@oracle11g ~]# echo $[ ~3 ] //取反,将所有的二进制位1->0, 0->1
-4
2、赋值运算
- [simpleanti@PLATQA136025 logs]$ var=100
- [simpleanti@PLATQA136025 logs]$ let var=$var+4
- [simpleanti@PLATQA136025 logs]$ echo $var
- 104
- [simpleanti@PLATQA136025 logs]$ let var+=5
- [simpleanti@PLATQA136025 logs]$ echo $var
- 109
3、表达式替换
9