add new chinese translations
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
# case
|
||||
|
||||
> case ... esac 与其他语言中的 switch ... case 语句类似,是一种多分枝选择结构。
|
||||
> 更多信息:<https://www.gnu.org/software/bash/manual/bash.html#index-case>.
|
||||
> Bash 内置结构,用于创建多选条件语句。
|
||||
> 更多信息:<https://www.gnu.org/software/bash/manual/bash.html#index-case>。
|
||||
|
||||
- 通过字符串字面量判断执行分支:
|
||||
- 将变量与字符串字面量进行匹配,以决定运行哪个命令:
|
||||
|
||||
`case {{入参变量}} in {{字符字面量}}) {{wc -w 执行语句块}}; ;; {{字符串}}) {{wc -l 执行语句块}}; ;; esac`
|
||||
`case {{$tocount}} in {{words}}) {{wc -w README}}; ;; {{lines}}) {{wc -l README}}; ;; esac`
|
||||
|
||||
- 搭配通配符进行匹配,判断执行分支:
|
||||
- 使用 | 组合模式,使用 * 作为后备模式:
|
||||
|
||||
`case {{入参变量}} in {{[wW]|字符字面量}}) {{wc -w 执行语句块}}; ;; {{[lL]|字符串}}) {{执行语句块}}; ;; *) {{echo "what?"}}; ;; esac`
|
||||
`case {{$tocount}} in {{[wW]|words}}) {{wc -w README}}; ;; {{[lL]|lines}}) {{wc -l README}}; ;; *) {{echo "what?"}}; ;; esac`
|
Reference in New Issue
Block a user