Skip to content

Commit 96048c4

Browse files
authored
add string expression explanation
添加了一些表达式说明以及对齐注释
1 parent cd6d4ee commit 96048c4

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

docs/operating-system/Shell.md

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -235,12 +235,16 @@ echo ${str:0:10} #输出:SnailClimb
235235
#author:amau
236236

237237
var="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 数组

0 commit comments

Comments
 (0)