The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Awk - select from a list simha77777 UNIX for Dummies Questions & Answers 14 02-07-2008 08:42 AM
Drop down menu in bash for timezone select simonb Shell Programming and Scripting 1 04-29-2006 10:02 AM
Generating a list of choices in a menu sysera Shell Programming and Scripting 7 01-05-2006 01:13 PM
dynamic Select menu rawatds Shell Programming and Scripting 2 12-06-2004 01:54 AM
Dynamic select with multiple word menu items domivv Shell Programming and Scripting 5 07-22-2004 05:52 AM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 09-13-2006
Registered User
 

Join Date: Sep 2006
Posts: 23
Stumble this Post!
reappearing menu list using select

is there a way I can make the menu list reappear when I use select ?

-----

menulist="Change_title Remove_tag Change_tag Add_line Quit"

select word in $menulist #change_title remove_tag change_tag add_line quit

do

case $word in

# first menu option Change Title

Change_title)

.....


after choosing the first time and running the script, the menu option will not reappear, the script will only prompt #? instead of the whole menu list.


thanks
Steffen
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 09-13-2006
Registered User
 

Join Date: Mar 2006
Location: Bangalore,India
Posts: 1,397
Stumble this Post!
Code:
while [ 1 ]
do
select word in $menulist #change_title remove_tag change_tag add_line quit
do
if [ "$word" = "" ]
then
   exit
fi
case $word in

# first menu option Change Title

Change_title) 

.....

done
Reply With Quote
  #3 (permalink)  
Old 09-13-2006
Registered User
 

Join Date: Sep 2006
Posts: 23
Stumble this Post!
thanks, but that still only prompts me #? instead of the menu list again

Steffen
Reply With Quote
  #4 (permalink)  
Old 09-13-2006
Registered User
 

Join Date: Mar 2006
Location: Bangalore,India
Posts: 1,397
Stumble this Post!
chk this
Code:
PS3='Choose your word: '
while [ 1 ]
do
select word in "change_title" "remove_tag" "change_tag" "add_line" "quit"
do
if [ "$word" = "" ]
then
   exit
fi
echo $word
break
done
done
Reply With Quote
  #5 (permalink)  
Old 09-13-2006
Playing with Ubuntu Now!
 

Join Date: Oct 2005
Location: Chennai
Posts: 364
Stumble this Post!
i feel

Stefen, I think you should use the break statement for every 'case' option in the while loop. (i.e)
Code:
echo "Type Ctrl-C to Quit"
menulist="Change_title Remove_tag Change_tag Add_line"
while true
do

select word in $menulist #change_title remove_tag change_tag add_line quit

do

case $word in

Change_title ) echo "You selected change-title";break;;
Remove_tag ) echo "You selected to remove tag";break;;
Change_tag ) echo "change tag";break;;
Add_line ) echo "TO add line";break;;

esac;

done

done
To quit, you would have to use Interrupt.
Reply With Quote
  #6 (permalink)  
Old 09-13-2006
Registered User
 

Join Date: Sep 2006
Posts: 23
Stumble this Post!
this works for the first 4 menu options, the menu will reappear.

However, I also have a fifth menu option Quit which is supposed to end the program, but now even if I choose option quit it will still jump back to the menu selection. I do not want to use Ctrl-c to quit the program

Steffen
Reply With Quote
  #7 (permalink)  
Old 09-13-2006
Playing with Ubuntu Now!
 

Join Date: Oct 2005
Location: Chennai
Posts: 364
Stumble this Post!
use exit

use 'exit' instead of 'break' for the fifth option.
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 01:21 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0