test - evaluate an expression
test EXPR | [ EXPR ]
Options you will use
-f FILE / -d FILE / -e FILE- Regular file / directory / exists.
-r -w -x FILE- Readable / writable / executable by you.
-s FILE- Exists and is not empty.
-z STR / -n STR- String is empty / not empty.
STR = STR / !=- String comparison.
N -eq -ne -lt -le -gt -ge N- Integer comparison.
Gotchas
- In bash prefer [[ ]]: it does not word-split, it has =~ for regex and && || instead of -a -o. Use [ ] only when the script must run under /bin/sh.
Try test in a real terminal Free, in your browser - a real Ubuntu terminal to try it in, with missions that check your work.