linux 中字符串处理函数 ${i%%.*}
001、
[root@pc1 test2]# ls [root@pc1 test2]# str1="ab.cd_kk.mn_jjy" ## 测试字符串 [root@pc1 test2]# echo ${str1%%.*} ## 从左侧开始,删除.号右侧所有的内容 ab [root@pc1 test2]# echo ${str1%.*} ##从左侧开始, 删除最后一个.右侧的内容 ab.cd_kk

002、同上
[root@pc1 test2]# ls [root@pc1 test2]# str1="ab.cd_kk.mn_jjy" [root@pc1 test2]# echo ${str1%%_*} ab.cd [root@pc1 test2]# echo ${str1%_*} ab.cd_kk.mn

。

浙公网安备 33010602011771号