[root@localhost dev]# echo ${array[@]:0}
one two three four
[root@localhost dev]# echo ${array[@]#t*e} # 左边开始最短的匹配:"t*e",这将匹配到"thre"
one two e four
[root@localhost dev]# echo ${array[@]##t*e} # 左边开始最长的匹配,这将匹配到"three"
[root@localhost dev]# array=( [0]=one [1]=two [2]=three [3]=four )
[root@localhost dev]# echo ${array[@] %o} # 从字符串的结尾开始最短的匹配
one tw three four
[root@localhost dev]# echo ${array[@] %%o} # 从字符串的结尾开始最长的匹配
one tw three four
[root@localhost dev]# array=( [0]=one [1]=two [2]=three [3]=four )
第一个匹配到的,会被删除
[root@localhost dev]# echo ${array[@] /o/m}
mne twm three fmur
所有匹配到的,都会被删除
[root@localhost dev]# echo ${array[@] //o/m}
mne twm three fmur
没有指定替换子串,则删除匹配到的子符
[root@localhost dev]# echo ${array[@] //o/}
ne tw three fur
替换字符串前端子串
[root@localhost dev]# echo ${array[@] /#o/k}
kne two three four
替换字符串后端子串
[root@localhost dev]# echo ${array[@] /%o/k}
one twk three four