When making shell scripts
Use the following commands and include them at the top of your shell script.
set -e
This will make the script break if you do not check the return code immediately after returning.
To ignore errors again, use set +e
set -u
Ensure the variable has been defined.
For more info:
http://www.davidpashley.com/articles/writing-robust-shell-scripts.html
http://julipedia.meroh.net/2010/01/set-e-and-set-x.html
set -e
This will make the script break if you do not check the return code immediately after returning.
To ignore errors again, use set +e
set -u
Ensure the variable has been defined.
For more info:
http://www.davidpashley.com/articles/writing-robust-shell-scripts.html
http://julipedia.meroh.net/2010/01/set-e-and-set-x.html
Comments
Post a Comment