|
getopts question
I am trying to set up prompts when you don't enter the right information or dont enter the information at all, when executing a script. Below is the question that i am asking and i am not sure how to set up the if statements to make sure that the user enters the name, cpu's, memory and ip. I was told that getopts with a cease statement might be usefull, but im not sure how to apply it. Any help would be greatly appreciated...
NAME=$1
NCPUS=$2
MEMORY=$3
IP=$4
MACHINENAME=`hostname`
MASTERHOST=svvnyc702
echo "Do you wish to proceed with the creation of UAT ZONE zone-${NAME}, CPU's ${NCPUS}, MEMORY ${MEMORY}, IP ${IP}
<y or n> ? \c"
read WISH
echo
if [ $WISH = "n" ] ; then
echo "You chose no, good bye"
exit
fi
if [ ! $WISH = "y" ] ; then
echo in vaild optin g - exiting
exit
fi
|