![]() |
|
|
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 |
| Unix Variable Reference and Substitution | mugsymark | Shell Programming and Scripting | 8 | 06-16-2008 06:24 AM |
| Reference: WebObjects 5.4.1 Reference | iBot | UNIX and Linux RSS News | 0 | 03-11-2008 09:50 PM |
| How to reference a variable within sed? | rockysfr | Shell Programming and Scripting | 1 | 06-27-2007 05:04 AM |
| Circular reference | fidodido | Shell Programming and Scripting | 1 | 09-04-2006 12:04 PM |
| ms sql command reference | inquirer | Windows & DOS: Issues & Discussions | 2 | 08-21-2002 11:51 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Hi!
I need to determin the most efficient way to do something (rather simple, I thought). I'm currently echo(ing) a series of menu options, and reading the command input as the number associated with the entry. What I need to do is when the option 1 is selected, that it references a list and then fills in the variable the correct way. Example - if I have a friendly list of server names like: 1. Server 1 2. Server 2 (...and so on) However, in the command that I am envoking in the background it needs to be ipaddress : port. I don't want the IP address as the name on the menu, but it does need to be passed for the process to work correctly. How would I do this? Thanks! |
|
||||
|
I would have a function that uses a case statement, it takes the option argument and returns the various associated elements with that option in a strict order....
get_menu() { case "$1" in 1 ) echo "option one" echo "flim" echo "flam" ;; 2 ) echo "option two" echo "foo" echo "bar" * ) return 1; esac } then you could do get_menu 1 | while read N .... then you have also centralised all the behaviour of the menu |
|
||||
|
Ok guys, I think I'm missing something here.
I was using radoulov's example and had gotten much further. I see two things happening that I need to change. (1) When I select an option from the list, it simply outputs the $REPLY value back to the console. The user doesnt need to see this value, but instead it needs to be passed as a variable to the command to be executed. (2) Once I select an option from the list, it just keeps prompting me for another option to select and doesn't move on to complete the script. Am I missing an end, or done, or something? |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|