if [ $# = 0 ] then echo "$USAGE" exit 1 fi while getopts lfso: c do case $c in l) tail -$1 /etc/passwd exit 2;; f) head -$1 /etc/passwd exit 3;; s) grep $1 /etc/passwd | cut -d: -f7 exit 4;; o) OARG=$OPTARG;; \?) echo "$USAGE" exit 5;; esac done shift `expr $OPTIND - 1
if [ $# = 0 ] then echo "$USAGE" exit 1 fi while getopts l:f:s:o: c do case $c in l) tail -${OPTARG} /etc/passwd exit 2;; f) head -${OPTARG} /etc/passwd exit 3;; s) grep ${OPTARG} /etc/passwd | cut -d: -f7 exit 4;; o) OARG=$OPTARG;; \?) echo "$USAGE" exit 5;; esac done shift `expr $OPTIND - 1