1.${string:position}
在$string中从位置$position开始提取字串
2.实例
操作字符串样例:string=abc123ABC456xyz
索引下标从0开始 0123456789...........
字符串操作默认从左边开始进行
2.1.提取全部string字符串
命令:
echo ${string:0}
[root@rhel77 ~]# string=abc123ABC456xyz
[root@rhel77 ~]# echo ${string:0}
abc123ABC456xyz
[root@rhel77 ~]#
2.2.从第7位开始,提取string剩余子串
命令:
echo ${string:7}
[root@rhel77 ~]# echo ${string:7}
BC456xyz
[root@rhel77 ~]#