Last active
June 27, 2020 10:04
Star
You must be signed in to star a gist
Bash script template
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -eou pipefail | |
SCRIPT_ROOT=$(realpath $(dirname "${BASH_SOURCE[0]}")/../..) # adjust as needed to go to root directory | |
SCRIPT_NAME=$(basename "${BASH_SOURCE[0]}") | |
pushd $SCRIPT_ROOT | |
# http://redsymbol.net/articles/bash-exit-traps/ | |
function cleanup() { | |
popd | |
} | |
trap cleanup EXIT |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment