Skip to content

Instantly share code, notes, and snippets.

@onpaws
Created April 16, 2014 20:04
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save onpaws/10927320 to your computer and use it in GitHub Desktop.
Save onpaws/10927320 to your computer and use it in GitHub Desktop.
bash: start here
#!/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