For small scripts a built-in option parser beats a hand-written loop of shifts.
while getopts 'f:v' opt; do
case $opt in f) file=$OPTARG ;; v) verbose=1 ;; *) exit 2 ;; esac
done
shift $((OPTIND-1))
A letter followed by a colon takes an argument, which lands in $OPTARG. Letters without a colon are plain switches. After the loop, shift $((OPTIND-1)) leaves only the remaining arguments in $@. getopts handles short options only. For long ones like --file, you need a manual case loop.
Further reading: Bash manual: getopts