Skip to content

Instantly share code, notes, and snippets.

View gtenagli's full-sized avatar

Giacomo Tenaglia gtenagli

View GitHub Profile
@gtenagli
gtenagli / gist:3416297
Created August 21, 2012 15:04
Bash script must-haves
# Taken from http://www.davidpashley.com/articles/writing-robust-shell-scripts.html
# abort when trying to use an unset variable
set -u # or set -o nounset
# exit on non-zero return codes from statements
# note: checking $? won't work any more, should use:
# command || { echo "command failed"; exit 1; }
set -e # or set -o errexit