From 96048c4fd067f5b8b034b8fbc0566c4422f7c2c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BD=90?= <48374300+wulnm@users.noreply.github.com> Date: Sun, 13 Jun 2021 20:14:14 +0800 Subject: [PATCH] add string expression explanation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 添加了一些表达式说明以及对齐注释 --- docs/operating-system/Shell.md | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/docs/operating-system/Shell.md b/docs/operating-system/Shell.md index 53466d11..c4d4d43a 100644 --- a/docs/operating-system/Shell.md +++ b/docs/operating-system/Shell.md @@ -235,12 +235,16 @@ echo ${str:0:10} #输出:SnailClimb #author:amau var="https://www.runoob.com/linux/linux-shell-variable.html" - -s1=${var%%t*}#h -s2=${var%t*}#https://www.runoob.com/linux/linux-shell-variable.h -s3=${var%%.*}#http://www -s4=${var#*/}#/www.runoob.com/linux/linux-shell-variable.html -s5=${var##*/}#linux-shell-variable.html +# %表示删除从后匹配, 最短结果 +# %%表示删除从后匹配, 最长匹配结果 +# #表示删除从头匹配, 最短结果 +# ##表示删除从头匹配, 最长匹配结果 +# 注: *为通配符, 意为匹配任意数量的任意字符 +s1=${var%%t*} #h +s2=${var%t*} #https://www.runoob.com/linux/linux-shell-variable.h +s3=${var%%.*} #http://www +s4=${var#*/} #/www.runoob.com/linux/linux-shell-variable.html +s5=${var##*/} #linux-shell-variable.html ``` ### Shell 数组