Skip to content

Instantly share code, notes, and snippets.

@karl-gustav
Last active January 3, 2020 14:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save karl-gustav/351855760ff3683cdf75614ee1ea1804 to your computer and use it in GitHub Desktop.
Save karl-gustav/351855760ff3683cdf75614ee1ea1804 to your computer and use it in GitHub Desktop.
safe bash scripts
#######COPY THIS#######
set -euo pipefail
#######################
# Exit immediately when a command fails.
set -e
# Fail if any step in pipe fails, not just the last one
set -o pipefail
# Treat unset variables as an error and exit immediately.
set -u
# Print commands as they execute
set -x
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment