![]() |
|
|
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 |
| reappearing menu list using select | forever_49ers | Shell Programming and Scripting | 9 | 09-13-2006 05:05 PM |
| Dynamic Menu Help | ScottKe | Shell Programming and Scripting | 3 | 08-30-2006 07:06 PM |
| Drop down menu in bash for timezone select | simonb | Shell Programming and Scripting | 1 | 04-29-2006 02:02 PM |
| dynamic Select menu | rawatds | Shell Programming and Scripting | 2 | 12-06-2004 05:54 AM |
| Multiple for loops within a Menu? | darthur | UNIX for Dummies Questions & Answers | 3 | 12-10-2001 06:01 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Dynamic select with multiple word menu items
Hello all,
I'm developing a deployment script at work and at one point it would need to display something like this: Which version of ADMIN would you like to deploy? 1) 1.0.0 (store1, 10 Jan 2004) 2) 1.0.1 (store1, 20 Jun 2004) 3) 1.0.2 (store1, 15 Jul 2004) Select a version : I know how I could do this in the hardcoded way, BUT the list of menu items being displayed is collected dynamically when needed. The actual question being : Is it possible to somehow parameterise the select statement so that it displays menu items in which blanks can appear. Example of hardcoded way : select option in "one one" "two two"; do break done displays: 1) one one 2) two two So, how can this "one one" "two two" part in the select be replaced by something that is parameterised. Thanks. |
|
||||
|
Ok, tried it. The example works of course.
Now image that the actual data is completely unknown and dynamically created. The result in my case is put in file. This would mean a flat text file with something like this : one one two two in it. The contents of the file can be modified to make it work, but I don't seem to succeed. |
|
||||
|
Ok, just figured it out ! For those who might be interested, this is what I did.
1) source file with following contents: one one two two 2) the coding: ix=0 while read record; do item[$ix]="$record" ix=$(($ix+1)) done < cat source set "${item[@]}" select n in "$@"; do break done 3) the result: 1) one one 2) two two #? |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|