Skip to content

Instantly share code, notes, and snippets.

@micha
Created May 24, 2020 01:20
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 micha/a003924ae5a7928ce6f30232ce0e318b to your computer and use it in GitHub Desktop.
Save micha/a003924ae5a7928ce6f30232ce0e318b to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
prog=$0
warn() { [ $# -gt 0 ] && echo $prog: "$@" 1>&2; }
abort() { warn "$@"; exit 1; }
usage() {
warn "$@"
cat <<EOT
USAGE: $(basename $prog) [-h]
Prints "hello world" to stdout.
OPTIONS:
-h Print this and exit.
EOT
exit;
}
while getopts "h" o; do
case "${o}" in
h) usage ;;
?) abort ;;
esac
done
shift $((OPTIND-1))
echo hello world
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment