标签:字符子串
本人初学linux运维,在观看oldboy视频教程后,对学习到的知识进行总结,知识内容均出自oldboy视频教程。
#########################################################################
[root@mode scripts]# OLDBOY="I am oldboy"
[root@mode scripts]# echo $OLDBOY
I am oldboy
[root@mode scripts]# echo ${#OLDBOY}
11
[root@mode scripts]# echo ${OLDBOY:2}
am oldboy
[root@mode scripts]# echo ${OLDBOY:0}
I am oldboy
[root@mode scripts]# echo ${OLDBOY:5}
oldboy
[root@mode scripts]# echo ${OLDBOY:2:5}
am ol
[root@mode scripts]# echo ${OLDBOY#I am}
oldboy
[root@mode scripts]# echo ${OLDBOY##I am}
oldboy
[root@mode scripts]# echo ${OLDBOY%I am}
I am oldboy
[root@mode scripts]# echo ${OLDBOY/oldboy/tiancao}
I am tiancao
[root@mode scripts]# OLDBOY="oldboy I am oldboy"
[root@mode scripts]# echo ${OLDBOY/oldboy/tiancao}
tiancao I am oldboy
[root@mode scripts]# echo ${OLDBOY/%oldboy/tiancao}
oldboy I am tiancao
本文出自 “11961592” 博客,请务必保留此出处http://11971592.blog.51cto.com/11961592/1841441
标签:字符子串
原文地址:http://11971592.blog.51cto.com/11961592/1841441