I have a script which takes user input as options provided
PS3="Select option to do deploy : "
select OPTION in "eardeploy" "hotdeploy"
do
case $OPTION in
"eardeploy" )
eardeploy.sh
break;;
"hotdeploy" )
hotdeploy.sh
break;;
esac
done
Now to provide these userinputs through command line args I used getopts in my script
while getopts "o:h" options; do
case $options in
o ) OPTION=$OPTARG;;
h|\?|* ) echo -e $usage
exit 1;;
esac
done
Is it possible to make my script work in two scenarios simultaneously
- work with the user inputs given as options
- work when user inputs are given as command line args so that it wont show the above options for user input.
Please help.