
June 13th, 2005, 09:13 AM
|
|
Contributing User
|
|
Join Date: Dec 2004
Location: Prague, Czech Rep.
Posts: 117
  
Time spent in forums: 22 h 42 m 44 sec
Reputation Power: 6
|
|
Quote: | Originally Posted by anzix Hello,
I have been learning shell scripting for about a week. I created a menu that allows you select options but when an option is seleted it terminates the script how would I loop the option to go back to the menu.
For the menu i am using the case function.
Code:
case $choice in
1) whoison # calls the e-mail function
;;
2) thecal # calls the whoison function
;;
3) whereami # calls the thedate function
;;
4) changedir # changes the directory
;;
5) listfiles # lists files in current directory
;;
6) thedate # displays the date & time
;;
7) startvi # starts vi
;;
8) theemail # start e-mail
;;
9) echo "Thank you for running this program!";
exit 0
;;
*) echo "Invaild option; try running the program again.";
exit 0
;;
esac
|
Hello,
put your case statement into an endless loop like this:
while :
do
# your case
done
In your case statement the oprion "9" will end the loop.
Regards 
|