Created
July 12, 2024 11:35
-
-
Save RobinBastiaan/86750426f489b13bd50cdab621a8a284 to your computer and use it in GitHub Desktop.
Boilerplate for creating a Shell Script
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
#!/usr/bin/env bash | |
set -o errexit | |
set -o nounset | |
set -o pipefail | |
if [[ "${TRACE-0}" == "1" ]]; then | |
set -o xtrace | |
fi | |
if [[ "${1-}" =~ ^-*h(elp)?$ ]]; then | |
echo 'Usage: ./script.sh arg-one arg-two | |
This is an awesome bash script to make your life better. | |
' | |
exit | |
fi | |
cd "$(dirname "$0")" | |
main() { | |
echo do awesome stuff | |
} | |
main "$@" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Source: https://msamgan.com/boilerplate-for-creating-a-shell-script