I realise that shift moves the array of cli args n space to the left, and the default of n is 1. This means I can assign the values the array to existing varibles using $1 shift inside a while loop. What I don't quite understand is why it is used in this context below. The input args have been assigned to values already and deleting shift $((OPTIND-1)) doesnt change this fact. Source: http://linux.die.net/man/3/optind
while getopts ":h:a:fc" opt; do
case $opt in
h)
print_help
exit 0
;;
a)
aaaa=${OPTARG}
;;
f)
force=1
;;
c)
CLEAN=1
;;
\?)
echoerr "Invalid option -$OPTARG"
print_help
exit 1
;;
esac
done
shift $((OPTIND-1))