Skip to content

Instantly share code, notes, and snippets.

@harkabeeparolus
Last active January 18, 2024 10:42
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 harkabeeparolus/b84d6ffc0c421db0c147bb9c201dacd8 to your computer and use it in GitHub Desktop.
Save harkabeeparolus/b84d6ffc0c421db0c147bb9c201dacd8 to your computer and use it in GitHub Desktop.
Standard bash script template with unofficial strict mode
#! /usr/bin/env bash
set -o errexit -o nounset -o errtrace -o pipefail
IFS=$'\n\t'
shopt -s nullglob
# shellcheck disable=SC2154
trap 's=$?; echo >&2 "$0: Error on line "$LINENO": $BASH_COMMAND"; exit $s' ERR
warn() { [ $# -ge 1 ] && printf >&2 "%s\n" "$*"; }
main() {
echo Hello World!
}
main
warn Exiting ...
exit 0
@harkabeeparolus
Copy link
Author

harkabeeparolus commented Jul 16, 2020

Sources:

Tools:

Further reading:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment