...
- To stop execution immediately when an error is detected
- Have the last line of the log file describe the fatal error (easy to tail)
- Make it easy to frequently check for errors of different sorts in our code
- Report the check being done (even when successful) in order to leave "bread crumbs" in the log file for troubleshooting.
- Report all diagnostics to standard error so it will not interfere, for example, with a functions standard output that is meant to be captured by the caller
- i.e., if a function performs error checks and reports information on standard output, only the standard output will be captured by backtick or parentheses evaluation.
The step_04.sh Script
Here's a step_04.sh script that builds on our step_03.sh work. Copy it from ~/workshop/step_04.sh, or copy and paste this text into a new file, ~/step_04.txt in your home directory. Make sure it is executable (chmod +x ~/step_04.txt).
...