[

Evaluate condition.

TLDR

Test if a given variable is equal to a given string

$ [ "[$MY_VAR]" == "[/bin/zsh]" ]
copy

Test if a given variable is empty

$ [ -z "[$GIT_BRANCH]" ]
copy

Test if a file exists

$ [ -f "[path/to/file_or_directory]" ]
copy

Test if a directory does not exist

$ [ ! -d "[path/to/directory]" ]
copy

If-else statement

$ [ [condition] ] && [echo "true"] || [echo "false"]
copy

Copied to clipboard
Coindodo