SKIPBLANKS= TMPDIR=/tmp CASE=lower while [[ "$1" = -* ]] # Remember, [[ = ]] does pattern match do case $1 in -b) SKIPBLANKS=TRUE ;; -t) if [ -d "$2" ] then TMPDIR=$2 shift else print "$0: -t takes a directory argument." >&2 exit 1 fi ;; -u) CASE=upper ;; --) break ;; # Stop processing options *) print "$0: Invalid option $1 ignored." >&2 ;; esac shift done