Created
May 3, 2021 15:49
-
-
Save krumeich/1f15e39c5a9aa8d8b51607a7e427ebf5 to your computer and use it in GitHub Desktop.
Template für bash 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
#!/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