${#字符串}
返回字符串的长度
[root@localhost ~]# a=length
[root@localhost ~]# echo ${#a}
6
${字符串:位置x}
从位置x开始往后截取子字符串,不包含x上的字符串
[root@localhost ~]# a=length
[root@localhost ~]# echo ${a:3}
gth
${字符串:位置x:长度y}
从位置x开始,截取长度为y的子字符串
[root@localhost ~]# a=length
[root@localhost ~]# echo ${a:2:2}
ng
${字符串/被替换的字符串/替换后的字符串}
[root@localhost ~]# a=123454321
[root@localhost ~]# echo ${a/1234/9876}
987654321