Please when asking about shell programming specify your system, the first line of your script, shell you use, version of your shell, and give a working (or not working but full) example of your script.
I'd suggest that the script should exit if the user enters an invalid option.
However, I can think of a way around this.
---------- Post updated at 09:20 AM ---------- Previous update was at 09:11 AM ----------
Try this:
add the ':' at the begining of getopts.
add ?) to the case statement and do what you want in there.
while getopts ":dhqTv" OPT # While there is a command line option
do
case $OPT in
d)
;;
h) print_options;;
q)
;;
T)
;;
v)
;;
?) print_status_message "ERROR: Unknown flag encountered.\n" ERROR
;;
esac
done # end -