I have a command script i'm making and wondering how do i go about combining multiple options
the general usage of the command is as follows:
Usage: myCommand [-fpr] [-n count] [-s size] [-u user] [-d directory]
My question refers to the [-fpr] option. If the user types myCommand -fpr or myCommand -fp how do I combine/concatenate the options together if it's in a while loop?
while getopts "fpr" opt; do
case $opt in
f)
echo `-l`
echo "-f was triggered!" >&2
;;
p)
echo `-h`
echo "-p was triggered!" >&2
;;
r)
echo "-r was triggered!" >&2
;;
\?)
echo "Invalid option: -$OPTARG\n" >&2
usage
;;
esac
done
echo `-h`
does not make sense as it tries to execute-h
and then echo it's output...