|
|
|
|
|
by jolmg
2167 days ago
|
|
To expand on that pattern: while (( $# )); do
case "$1" in
-h|--help)
usage
exit
;;
-v|--version)
do_version
exit
;;
-d|--debug)
debug=true
;;
-a|--arg)
arg_value="$2"
shift
;;
*)
if [[ ! -v pos1 ]]; then
pos1="$1"
elif [[ ! -v pos2 ]]; then
pos2="$1"
else
>&2 printf "%s: unrecognized argument\n" "$1"
>&2 usage
exit 1
fi
esac
shift
done
|
|