Skip to content

Instantly share code, notes, and snippets.

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 krumeich/1f15e39c5a9aa8d8b51607a7e427ebf5 to your computer and use it in GitHub Desktop.
Save krumeich/1f15e39c5a9aa8d8b51607a7e427ebf5 to your computer and use it in GitHub Desktop.
Template für bash script
#!/bin/bash
function usage() {
echo 'Usage: $0 [-o|--option <arg>]'
exit 2
}
function processCmdLine() {
while [ -n "$1" ]; do
case "$1" in
-o | --option) the_option="$2"; shift; shift;;
*) usage && exit 1;;
esac
done
the_option="${the_option:-DEFAULT}"
}
processCmdLine $@
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment