mirror of
https://github.com/tldr-pages/tldr.git
synced 2025-04-22 05:22:09 +02:00
if: add if conditions with examples (#3206)
This commit is contained in:
parent
27ce3194bd
commit
89a3e79198
1 changed files with 16 additions and 0 deletions
|
@ -9,3 +9,19 @@
|
|||
- Full if syntax:
|
||||
|
||||
`if {{condition}}; then echo "true"; else echo "false"; fi`
|
||||
|
||||
- List available if conditions:
|
||||
|
||||
`help test`
|
||||
|
||||
- Test if a given variable is empty:
|
||||
|
||||
`if [[ -z $GIT_BRANCH ]]; then echo "true"; else echo "false"; fi`
|
||||
|
||||
- Test if a file exists:
|
||||
|
||||
`if [[ -e {{filename}} ]]; then echo "true"; else echo "false"; fi`
|
||||
|
||||
- If directory not exists:
|
||||
|
||||
`if [[ ! -d {{path/to/directory}} ]]; then echo "true"; else echo "false"; fi`
|
||||
|
|
Loading…
Add table
Reference in a new issue