Conditions
Appearance
General
- A shell script can test the exit code of any command that can be invoked from the cli
- That's why you should include an exit command at the end of any scripts you write
- test and [ ] are synonymous
- don't name programs test or it will get jacked up
- Here is the first line of an if statement written each way
- if test -f blah.py
- if [ -f blah.py ]
- The spaces after the first brace and before the second one are required
- Mnemonic: [ ] means test, and you wouldn't do test-f