I feel like what I need to do, would be best accomplished with a loop.
However I dont have the slightest idea how to set that up.
The script is part of a interactive shell, for making settings to a Mac OS X server.
This particular part is in regards to disabling files services.
#!/bin/bash
clear
echo "Turn of Unused File Sharing Services"
echo
PS3='Please enter a choice from the above menu: '
stoplist=`cat <<EOT
AFP
SMB
FTP
NFS
EOT`
turnoffFunction ()
{
select CHOICE in ${stoplist[*]} Quit
do
case "$CHOICE" in
"") echo Hit Enter to see menu again!
continue
;;
Quit) break # exit the loop
;;
*) serveradmin stop $CHOICE |more
;;
esac
}
choiceFunction ()
{
echo -n "Would you like to turn off any more File Sharing Services? [y|n]"
read answer
if [ "$answer" = "y" ]; then
turnoffFunction
else
echo `date`
fi
}
turnoffFunction
choiceFunction
I want the user to have to ability to choose all of the choices if thats what they want to do.
The easy way out is just to use the two functions the total number of options available. But if they dont need to disable all the options, then i dont want to force them to go thru more then they have too.
Hopefully that makes since?
And if its not obvious, must of that code I borrowed.