![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| sed used in loops | riayi | Shell Programming and Scripting | 1 | 10-01-2008 03:59 AM |
| Loops | mariner | UNIX for Advanced & Expert Users | 2 | 07-01-2004 08:50 AM |
| no more loops | tony3101 | Shell Programming and Scripting | 5 | 06-09-2004 03:01 PM |
| loops in loops | Blip | Shell Programming and Scripting | 11 | 01-20-2004 01:38 PM |
| While loops | bookoo | UNIX for Dummies Questions & Answers | 5 | 08-23-2002 12:01 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
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. Code:
#!/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. |
|
||||
|
Quote:
Please let me know if I got you right. Then we may think further. Regards |
|
||||
|
Quote:
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. |
![]() |
| Bookmarks |
| Tags |
| shell script, shell scripting, unix scripting, unix scripting basics |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|