#!/bin/sh
# shellcheck disable=SC2034

while :; do
  case "$1" in
    -f | --file)
      file="$2"   # you may want to check validity of $2
      shift 2
      ;;
    -h | --help)
      usage  # call your function
      # no shifting needed here, were done.
      exit 0
      ;;
    -v | --verbose)
      #  its better to assign a string, than a number like "verbose=1"
      #  because if youre debugging the script with "bash -x" code like this:
      #    if [ "$verbose" ] ...
      #  you will see:
      #    if [ "verbose" ] ...
      #  instead of cryptic
      #    if [ "1" ] ...
      verbose="verbose"
      shift
      ;;
    --) # end of all options
      shift
      break;
      ;;
    -*)
      echo "Error: Unknown option: $1" >&2
      exit 1
      ;;
    *) # no more options
      break
      ;;
  esac
done
