diff --git a/docs/zh/server/administration/compa_command/utshell_guide.md b/docs/zh/server/administration/compa_command/utshell_guide.md index ad9d152cc569e034d71cf3d5255d813d69394103..404db2ba0b8c56e5441129c4599ea9ad7ff0b4a6 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