ZhangZhihui's Blog  
$>expr substr 'abcdefg' 1 3
abc

 

zzh@ZZHPC:~$ a=123456789
zzh@ZZHPC:~$ echo ${a:2}
3456789
zzh@ZZHPC:~$ echo ${a:3:3}
456
zzh@ZZHPC:~$ echo ${a:3:${#a}}
456789
zzh@ZZHPC:~$ echo ${a:(-3)}
789
zzh@ZZHPC:~$ echo ${a:0:-3}
123456
zzh@ZZHPC:~$ echo ${a:1:-3}
23456

 

posted on 2020-11-13 08:53  ZhangZhihuiAAA  阅读(148)  评论(0编辑  收藏  举报