From ac45c84ccb3cf681dc448a8644ba1d69098d2e00 Mon Sep 17 00:00:00 2001 From: htpeng Date: Wed, 15 Oct 2025 07:46:45 +0000 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9until=E8=AF=AD=E6=B3=95?= =?UTF-8?q?=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: htpeng --- .../compa_command/utshell_guide.md | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/docs/zh/server/administration/compa_command/utshell_guide.md b/docs/zh/server/administration/compa_command/utshell_guide.md index ad9d152..052cbf5 100644 --- a/docs/zh/server/administration/compa_command/utshell_guide.md +++ b/docs/zh/server/administration/compa_command/utshell_guide.md @@ -51,7 +51,7 @@ var=4 #### 变量使用 ```shell -echo \${var} +echo ${var} ``` ### 数组的定义和使用 @@ -59,13 +59,13 @@ echo \${var} #### 数组的定义 ```shell -distros=(ubuntu fedora suse \"arch linux\") +distros=(ubuntu fedora suse "arch linux") ``` #### 数组的使用 ```shell -echo \${distros\[2\]} +echo ${distros[2]} ``` ### 函数定义和使用 @@ -73,7 +73,7 @@ echo \${distros\[2\]} #### 函数的定义 ```shell -func() { echo \$1; } +func() { echo $1; } ``` #### 函数的调用 @@ -93,11 +93,11 @@ func firstParam secondParam ```shell func() { -echo \$1 \${10} \#需要传递 10 个参数 +echo $1 ${10} #需要传递 10 个参数 } -\#调用 +#调用 func 1 2 3 4 5 6 7 8 9 0 ``` @@ -131,13 +131,13 @@ fi 其中 condition 可以是命令,如: ```shell -if \[ \"\$s\" = \"string\" \]; then +if [ "$s" = "string" ]; then -echo \"string is equivalent to \\\$s\" +echo "string is equivalent to \$s" else -echo \"string is not equivalent to \\\$s\" +echo "string is not equivalent to \$s" fi ``` @@ -199,7 +199,7 @@ for number in 1 2 3 4 5 do -echo \$number +echo $number done @@ -209,7 +209,7 @@ for number in {1..500..2} do -echo \$number +echo $number done ``` @@ -219,7 +219,7 @@ done #### until 循环 ```shell -until \[condition\]; do +until [ condition ]; do commands @@ -231,7 +231,7 @@ done #### while 循环 ```shell -while \[ condition \]; do +while [ condition ]; do commands -- Gitee