Created
April 16, 2014 20:04
-
-
Save onpaws/10927320 to your computer and use it in GitHub Desktop.
bash: start here
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -o nounset | |
set -o errexit | |
<<COMMENT | |
via http://robertmuth.blogspot.com/2012/08/better-bash-scripting-in-15-minutes.html | |
To perform a syntax check/dry run of your bash script run: | |
bash -n myscript.sh | |
To produce a trace of every command executed run: | |
bash -v myscripts.sh | |
To produce a trace of the expanded command use: | |
bash -x myscript.sh | |
-v and -x can also be made permanent by adding | |
set -o verbose and set -o xtrace to the script prolog. | |
This might be useful if the script is run on a remote machine, e.g. | |
a build-bot and you are logging the output for remote inspection. | |
COMMENT |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment