Skip to content

Instantly share code, notes, and snippets.

@sean9999
Last active September 19, 2019 16:21
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 sean9999/4ad013c12752d15d2d58b8e4c4cc746a to your computer and use it in GitHub Desktop.
Save sean9999/4ad013c12752d15d2d58b8e4c4cc746a to your computer and use it in GitHub Desktop.
#strict #mode for the #bash #shell
#!/bin/bash
# @credit :: http://redsymbol.net/articles/unofficial-bash-strict-mode/
## -e :: instructs bash to immediately exit if any command has a non-zero exit status.
## -u :: a reference to any variable you haven't previously defined is an error, and causes the program to immediately exit
## -o pipefail :: If any command in a pipeline fails, that return code will be used as the return code of the whole pipeline
## IFS :: IFS stands for Internal Field Separator - controls what Bash calls word splitting
set -euo pipefail
IFS=$'\n\t'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment