前端之家收集整理的这篇文章主要介绍了
shell变量的子串的截取/删除/替换,
前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
[root@localhost SHELL]
[root# echo ${NAME//student/teacher}
I am a teacher teacher
[root# echo ${NAME/#student/teacher}
I am a student student
[root# echo ${NAME/%student/teacher}
I am a student teacher
[root# echo ${NAME/%I am /teacher}
I am a student student
[root# echo ${NAME/#I am /teacher}
teachera student student
[root# echo ${NAME/#I am a/teacher}
teacher student student
[root# echo $NAME
I am a student student
[root#
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
原文链接:https://www.f2er.com/bash/389981.html