[: add Chinese translation (#6381)

This commit is contained in:
千玄子 2021-08-18 20:16:03 +08:00 committed by GitHub
parent fe35df460c
commit 2c5efc2a73
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

25
pages.zh/common/[.md Normal file
View File

@ -0,0 +1,25 @@
# [
> 评估条件。
> 如果条件评估为真返回 0如果评估为假返回 1.
> 更多信息:<https://www.gnu.org/software/coreutils/test>.
- 测试给定变量是否与给定字符串相同:
`[ "{{$VARIABLE}}" == "{{/bin/zsh}}" ]`
- 测试给定变量是否为空值:
`[ -z "{{$GIT_BRANCH}}" ]`
- 测试某个文件是否存在:
`[ -f "{{文件}}" ]`
- 测试某个目录是否存在:
`[ ! -d "{{目录}}" ]`
- If-else 语句:
`[ {{条件语句}} ] && {{echo "true"}} || {{echo "false"}}`