#!/bin/bash
# filename: getopts-4.sh
while getopts ":af:" opts
do
  case $opts in
    a)
      echo a
      ;;
    f)
      TARGET_FILE=$OPTARG
      ;;
    :)
      echo "Option -$OPTARG requires an argument !!!" >&2
      ;;
    \?)
      echo "What is -$OPTARG option ???" >&2 
      ;;
  esac
done

if [ "$TARGET_FILE" != "" ]; then
  echo TARGET = $TARGET_FILE
fi

