opts
The code is looping though the ":ls" options, and setting the value of the "TAG_TYPE" variable according to the option given.
Shortcut: get_opts
while getopts ":ls" options; do
case ${options} in
l)
TAG_TYPE="long"
;;
s)
TAG_TYPE="short"
;;
:)
echo "ERROR: Invalid option: ${OPTARG} requires an argument" 1>&2
exit 1
;;
\?)
echo "ERROR: Invalid option: ${OPTARG}" 1>&2
exit 1
;;
esac
done
shift $((OPTIND - 1))