File tree Expand file tree Collapse file tree 1 file changed +10
-6
lines changed
Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -235,12 +235,16 @@ echo ${str:0:10} #输出:SnailClimb
235235# author:amau
236236
237237var=" https://www.runoob.com/linux/linux-shell-variable.html"
238-
239- s1=${var%% t* } # h
240- s2=${var% t* } # https://www.runoob.com/linux/linux-shell-variable.h
241- s3=${var%% .* } # http://www
242- s4=${var#*/ } # /www.runoob.com/linux/linux-shell-variable.html
243- s5=${var##*/ } # linux-shell-variable.html
238+ # %表示删除从后匹配, 最短结果
239+ # %%表示删除从后匹配, 最长匹配结果
240+ # #表示删除从头匹配, 最短结果
241+ # ##表示删除从头匹配, 最长匹配结果
242+ # 注: *为通配符, 意为匹配任意数量的任意字符
243+ s1=${var%% t* } # h
244+ s2=${var% t* } # https://www.runoob.com/linux/linux-shell-variable.h
245+ s3=${var%% .* } # http://www
246+ s4=${var#*/ } # /www.runoob.com/linux/linux-shell-variable.html
247+ s5=${var##*/ } # linux-shell-variable.html
244248```
245249
246250### Shell 数组
You can’t perform that action at this time.
0 commit comments