I have a script in which accepts the following arguments: ./script [-dph] [-peh] The first argument tells the script if I need to execute it with production scripts or with development scripts. The second argument tells the script if the output of the report generated should be sent as an email or should be redirected to a html page.
When I use getopts, I get an option to do with one option.
while getopts "dph" opt_name
do
case "$opt_name" in
h)
helpText
exit 1
;;
d)
#Use Dev env
;;
p)
#Use Prod env
;;
*)
echo "Wrong command line argument. Exiting...";
exit 1
;;
esac
done
How do I do it with two options in which the second argument means a different action based on the first argument?
P.S.: Please note that I know that having options for dev and prod env is not the best solution around, but my app is in a proof of concept stage and hence, I am using whatever I know to build this.