2015-12-12 22:08:54 +00:00
|
|
|
# test
|
|
|
|
|
|
|
|
> Evaluate condition.
|
|
|
|
> If it is true, returns 0 exit status, otherwise returns 1.
|
|
|
|
|
2016-01-07 17:31:27 +00:00
|
|
|
- Test if given variable is equal to given string:
|
2015-12-12 22:08:54 +00:00
|
|
|
|
|
|
|
`test $MY_VAR == '/bin/zsh'`
|
|
|
|
|
2016-01-07 17:31:27 +00:00
|
|
|
- Test if given variable is empty:
|
2015-12-12 22:08:54 +00:00
|
|
|
|
|
|
|
`test -z $GIT_BRANCH`
|
|
|
|
|
2016-01-07 17:31:27 +00:00
|
|
|
- Test if file exists:
|
2015-12-12 22:08:54 +00:00
|
|
|
|
|
|
|
`test -e {{filename}}`
|
|
|
|
|
2016-01-07 17:31:27 +00:00
|
|
|
- Test if directory not exists:
|
2015-12-12 22:08:54 +00:00
|
|
|
|
|
|
|
`test ! -d {{path/to/directory}}`
|
|
|
|
|
2016-01-07 17:31:27 +00:00
|
|
|
- If-else statement:
|
2015-12-12 22:08:54 +00:00
|
|
|
|
|
|
|
`test {{condition}} && echo "true" || echo "false"`
|