Last active
September 8, 2018 19:00
-
-
Save DrSnowbird/829c15af3caff08b4177f2997e24e429 to your computer and use it in GitHub Desktop.
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 | |
# ------------------------------------ | |
# maintainer: DrSnowbird@openkbs.org | |
# license: Apache License Version 2.0 | |
# ------------------------------------ | |
ERROR_NO_ARGS_PROVIDED=99 | |
ERROR_ERROR_ARGS_PROVIDED=98 | |
SHORT="hdO:" | |
LONG="help,debug,output:" | |
PARSED=`getopt --options ${SHORT} --longoptions ${LONG} --name "$0" -- "$@"` | |
if [[ $? != 0 ]]; then | |
exit ${ERROR_ERROR_ARGS_PROVIDED} | |
fi | |
eval set -- "${PARSED}" | |
while true | |
do | |
case "${1}" in | |
-h) | |
usage | |
exit | |
;; | |
--help) | |
usage | |
exit | |
;; | |
-d) | |
debugFlag=1 | |
echo "debugFlag=$debugFlag (ON)" | |
shift | |
;; | |
--debug) | |
debugFlag=1 | |
echo "debugFlag=$debugFlag (ON)" | |
shift 1 | |
;; | |
-O) | |
OUTPUT_FILE=${2} | |
echo "OUTPUT_FILE=$OUTPUT_FILE" | |
shift 2 | |
;; | |
--output) | |
OUTPUT_FILE=${2} | |
echo "OUTPUT_FILE=$OUTPUT_FILE" | |
shift 2 | |
;; | |
--) | |
shift | |
break | |
;; | |
*) | |
echo "*****: input args error" | |
echo "$ORIG_ARGS" | |
exit 3 | |
;; | |
esac | |
done | |
echo "ORIGINAL INPUT >>>>>>>>>>:" | |
echo "${ORIG_ARGS}" | |
echo "-------------" | |
#### ------------------------------------------------------------------------------------------------------------ | |
#### ---- MAIN: ---- | |
#### ------------------------------------------------------------------------------------------------------------ | |
echo "..... Start your main here .............." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment