X-Git-Url: https://feistymeow.org/gitweb/?a=blobdiff_plain;f=infobase%2Fexamples%2Fbashisms%2Fexample_getops_parsing.txt;fp=infobase%2Fexamples%2Fbashisms%2Fexample_getops_parsing.txt;h=1f26b80a43f255c0348f81fc1c5da3e12259a92f;hb=8f403891425dfe131948be97cae4edf21f3f7869;hp=0000000000000000000000000000000000000000;hpb=a4d12589f1cd01826814842cde0b3eac95890bc9;p=feisty_meow.git diff --git a/infobase/examples/bashisms/example_getops_parsing.txt b/infobase/examples/bashisms/example_getops_parsing.txt new file mode 100644 index 00000000..1f26b80a --- /dev/null +++ b/infobase/examples/bashisms/example_getops_parsing.txt @@ -0,0 +1,16 @@ + +# shell option parsing -- old school version only handles single dash options. + +while getopts "fr:q:a:h" opt; do + case "${opt}" in + f) force_query=1; ;; + r) row_num="${OPTARG}"; ;; + q) queue_name="${OPTARG}"; ;; + a) alias_name="${OPTARG}"; ;; + h) usage 1>&2; exit ${EX_OK}; ;; + ?) usage 1>&2; exit ${EX_USAGE}; ;; + esac +done + +shift $(($OPTIND - 1)) +