1
0
Fork 0
mirror of https://github.com/tldr-pages/tldr.git synced 2025-04-29 23:24:55 +02:00
tldr/pages/common/[.md
Ignacio Mattos 369d034b50
[, aapt, ab: add Spanish translation (#5840)
* [: add Spanish translation

* aapt: add Spanish translation

* ab: add Spanish translation
2021-04-30 10:01:31 -03:00

545 B

[

Evaluate condition. Returns 0 if the condition evaluates to true, 1 if it evaluates to false. More information: https://www.gnu.org/software/coreutils/test.

  • Test if a given variable is equal to a given string:

[ "{{$VARIABLE}}" == "{{/bin/zsh}}" ]

  • Test if a given variable is empty:

[ -z "{{$GIT_BRANCH}}" ]

  • Test if a file exists:

[ -f "{{path/to/file}}" ]

  • Test if a directory does not exist:

[ ! -d "{{path/to/directory}}" ]

  • If-else statement:

[ {{condition}} ] && {{echo "true"}} || {{echo "false"}}