Last active
June 8, 2019 05:46
-
-
Save gpoole/e3a7196b8915ad029637e7223fe4443c to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#!/usr/bin/env bash | |
# https://www.davidpashley.com/articles/writing-robust-shell-scripts/ | |
set -ue | |
# Enable more complex glob patterns | |
shopt -s globstar | |
usage() { | |
echo "usage" | |
} | |
OPTERR=0 | |
while getopts "hs:" opt; do | |
case $opt in | |
h) | |
usage | |
exit | |
;; | |
s) | |
setting=$OPTARG | |
;; | |
\?) | |
usage | |
exit 1 | |
;; | |
esac | |
done | |
# Clear processed options | |
shift $((OPTIND-1)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment