Skip to content

Instantly share code, notes, and snippets.

@luminoso
Created October 27, 2022 08:08
Show Gist options
  • Save luminoso/d6ebe097ef06cb6580fc7835a3fa62ca to your computer and use it in GitHub Desktop.
Save luminoso/d6ebe097ef06cb6580fc7835a3fa62ca to your computer and use it in GitHub Desktop.
bash script template
#!/usr/bin/env bash
# template source: https://news.ycombinator.com/item?id=33352967
set -o errexit
set -o nounset
set -o pipefail
if [[ -n "${TRACE-}" ]]; 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