#!/bin/bash
# filename: getopts-3.sh
while getopts "abf:" opts
do
  case $opts in
    a)
      echo a
      ;;
    b)
      echo b
      ;;
    f)
      TARGET_FILE=$OPTARG 
      ;;
  esac
done

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