If you’re scripting with bash, and haven’t encountered the getopts function, then you should read the following
article @ linux.com.
The getopts function is an -easy to use- function when you’re working with script where parameters and flags have to be set.
while getopts ":f:p:c:s:d r v" o ; do case $o in f ) FILE=$OPTARG;; p ) PARA=$OPTARG;; c ) VALU=$OPTARG;; s ) DELI=$OPTARG;; d ) DEBUG=y;; r ) RO=y;; v ) echo $VERSION exit 0;; esac done
The options with a colon (“:”) in front of them need to have an argument set. Yet if there is a space, then no argument is needed.
So -r -d & -v are the flags. Where the others are options/parameters that can be set.