help making loops

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.

If you mean to say that the user must be able to either select an option of his choice or ALL the options.. then you ll need to explicitly show him the option - ALL.

Please let me know if I got you right. Then we may think further.

Regards

This will loop and ask for actions until it receives the code (a 9) to stop. There are not any commands to be run, but that could be handled with if or case statements. (You were asking about loops.)

> cat script82.sh
while [ "$user_rsp" != "9" ]
   do
   echo "###"
   echo "### What to do next ?"
   echo "###"
   echo "### 1 - do this"
   echo "### 2 - do that"
   echo "### 3 - do the other"
   echo "### 9 - all done"
   echo "###"
   read user_rsp
  
   echo $user_rsp

done

Thats kinda of right. But i need to to have the ability to pick and choose.

The all choice is good, but I need the user to have the ability to also be able to pick more then just one. And it could be any combination of the options.

Functionally, I guess it would work if it kept asking the user until they chose to quit the command.