Last active
November 19, 2021 03:24
-
-
Save kborovik/da2d7e86578efe30bc655b711d3370fb to your computer and use it in GitHub Desktop.
getopts template
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
if [[ ! ${*} =~ ^\-.+ ]]; then | |
help-function | |
fi | |
while getopts "chd" opt; do | |
case $opt in | |
c) | |
c-function | |
exit 0 | |
;; | |
h) | |
h-function | |
exit 0 | |
;; | |
d) | |
d-function | |
exit 0 | |
;; | |
?) | |
help-function | |
exit 1 | |
;; | |
esac | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment