Skip to content

Instantly share code, notes, and snippets.

@jc00ke
Last active July 27, 2025 17:19
Show Gist options
  • Save jc00ke/063034679f777d44077dbe50ea6a7d33 to your computer and use it in GitHub Desktop.
Save jc00ke/063034679f777d44077dbe50ea6a7d33 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
# from https://gist.github.com/kovetskiy/a4bb510595b3a6b17bfd1bd9ac8bb4a5#gistcomment-3367404
set -euxo pipefail
trap 'echo "Exit status $? at line $LINENO from: $BASH_COMMAND"' ERR
# from https://utcc.utoronto.ca/~cks/space/blog/programming/BashGoodSetEReports
Help=$(cat <<-"HELP"
my-script — does one thing well
Usage:
my-script <input> <output>
Options:
<input> Input file to read.
<output> Output file to write. Use '-' for stdout.
-h Show this message.
HELP
)
help() {
echo "$Help"
}
if [[ $# == 0 ]] || [[ "$1" == "-h" ]]; then
help
exit 1
fi
echo Hello World