getopts is a nice way to get simple arguments, rather than having to write your own code to get them.
design= dev= while getopts dvf: arg do case $name in d) design=1;; v) dev=1 ;; f) file="$OPTARG";; ?) printf "Usage: %s: [--design] [--dev]\n" $0 exit 2;; *) echo "You specified a wrong argument";; esac done
You specify the args after getopts (where you see ‘dvf:’). The
: after the
f means that one gets an argument. You then list all your arguments in the
case section, with
* being special. See
man getopts for more information.