[root@IPv6 gaole_scripts]# expr length ${a}
expr: syntax error #一定要加双引号
[root@IPv6 gaole_scripts]# echo $a
my name is test
[root@IPv6 gaole_scripts]# expr length "test"
4
[root@IPv6 gaole_scripts]# expr length "test a"
6
[root@IPv6 gaole_scripts]# expr length "${a}" #返回字符串长度
15
[root@IPv6 gaole_scripts]# expr index "$a" "nae" #nae是字符集,匹配任何一个单个字符,第一个匹配的元素下标,从1开始
4
[root@IPv6 gaole_scripts]# expr index "$a" "a"
5
[root@IPv6 gaole_scripts]# expr substr "$a" 3 5 从第三个开始,总共返回5个字符
name
expr 1 + 2
3, +左右要有空格
expr $a + $b