Sponsored Content
Top Forums Shell Programming and Scripting Dynamic select with multiple word menu items Post 53673 by domivv on Thursday 22nd of July 2004 02:34:02 AM
Old 07-22-2004
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.
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

dynamic Select menu

Hi all is menu driven by SELECT can be a dynamic ? My requirement is that i want SELECT to be created on run time not predefine . The select should be created as per the no of words in a file thanks in advance rawat (2 Replies)
Discussion started by: rawatds
2 Replies

2. Shell Programming and Scripting

Dynamic Menu Help

I'm working on a menu to read folders in as menu selections then CD to the selected folder and display the contained files as menu selections for execution. I'm using the following to read in the file list but I get lost after that. I only read in files that begin with CAPs. The problem is... (3 Replies)
Discussion started by: ScottKe
3 Replies

3. Shell Programming and Scripting

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 ... (9 Replies)
Discussion started by: forever_49ers
9 Replies

4. Shell Programming and Scripting

Error using select menu command

Hi All, I am trying to use the select command & the menu. below mention is my script #!/bin/bash 2 3 PS3="Is today your birthday? " #PS3 system variable 4 5 echo "\n" 6 7 8 select menu_selection in YES NO QUIT 9 do 10 11 ... (1 Reply)
Discussion started by: milindb
1 Replies

5. Web Development

Dynamic Drop Down Menu

I need to create a dynamic drop down menu which is populated by entries such as; htdocs/client1/index.php htdocs/client2/index.php htdocs/client3/index.php htdocs/client4/index.php etc. So htdocs/client*/index.php Is this possible? I know how to do this using normal arrays, but not... (2 Replies)
Discussion started by: JayC89
2 Replies

6. UNIX for Dummies Questions & Answers

Dynamic menu selection? Help..

Hi guys, i would like to create a program that allow user to show the information of certain thing such as network card. I would like the menu to be dynamic, for example: my computer system have 2 network card inserted at the moment, therefore the menu will have 2 choice for the user. eth0... (12 Replies)
Discussion started by: malfolozy
12 Replies

7. Shell Programming and Scripting

Help with 'select' for menu input

A lot of my scripting makes use of the 'select' command to create menu driven input. A typical example of how I use it is as: somevar='' PS3='Select one: ' while ]; do select somevar in $(sqlplus -s $dbuser/$dbpw@mydb <<EOF set echo off feedback off verify off... (7 Replies)
Discussion started by: edstevens
7 Replies

8. Shell Programming and Scripting

Stuck with menu in select

hi i am new to bash scripting .. i created a bunch of folders but only want the folder names with file1. so i go in and make an array to grab the folders the put in a file then i strip the directories so i just have the folder names i need then i would like to make the menu with a selection... (3 Replies)
Discussion started by: lamby22
3 Replies

9. UNIX for Beginners Questions & Answers

Issue with search and replacing multiple items in multiple files

Im having an issue when trying to replace the first column with a new set of values in multiple files. The results from the following code only replaces the files with the last set of values in val.txt. I want to replace all the files with all the values. for date in {1..31} do for val in... (1 Reply)
Discussion started by: ncwxpanther
1 Replies
LARSMENU(1x)															      LARSMENU(1x)

NAME
larsmenu - create a menu to run commands SYNOPSIS
larsmenu [ -bg background-color ] [ -display displayname ] [ -file name ] [ -fg foreground-color ] [ -font fname ] [ -geometry geom ] [ -iconic ] [ -label name ] [ -path ] [ -popdown ] [ -popup ] [ -shell prog ] [ -teleport ] [ -version ] [ -warp ] menuitem[:command] ... DESCRIPTION
larsmenu is a simple program that accepts a list of menu item and command pairs on the command line. It creates a window that consists of nothing but a menu. When a particular item is selected, the corresponding command is executed. Any mouse button may be used to select an item. Alternatively, the UP-ARROW and DOWN-ARROW cursor keys may be used to highlight different items, with ENTER used to select the highlighted item. ESCAPE exits the menu without selecting an entry. Menu items and commands are separated by a colon. The colon and command are optional. If they are missing, then the menu item is assumed to be a command that can be executed directly. A menu item consisting of the word exit causes larsmenu to exit when it is selected. Otherwise, to stop larsmenu, delete it using the win- dow manager. If a command is supplied along with the exit item, that command is executed before larsmenu exits. If a command starts with the word exec, larsmenu ceases operating after launching it. larsmenu accepts the following command line options, listed alphabetically: -bg background-color Set the background color to background-color. By default, the background color is white. -display displayname Use the X display displayname, instead of the default display. -file filename Read items to display from filename, in addition to any other command line arguments. This is intended for use with #! in scripts. -fg foreground-color Set the foreground color to foreground-color. By default, the foreground color is black. -font fname Use the font fname, instead of fixed. -geometry geom Use geom (a geometry in standard X format) as the geometry of the menu. This is most useful for specifying the initial loca- tion of the menu. Note that larsmenu overrides the size part of the geometry specification. The window is always just large enough to hold the menu. -iconic Start up in the iconified state. -label name Change both the window and icon labels of the window to name. -path Append the current directory to the command search path. -popdown Once an item is selected, the menu window automatically iconifies itself. -popup Act like a pop-up menu. Once a menu item is selected, larsmenu exits. This option overrides -popdown. -shell prog Use prog as the shell to run commands, instead of /bin/sh. If the shell cannot be executed, larsmenu then silently falls back to using /bin/sh. -teleport Move the menu to where the mouse is when the menu is uniconified. This option is particularly useful when combined with -popdown. -version This option prints the version of larsmenu on the standard output, and then exits with an exit value of zero. -warp Warp the mouse to the menu when the menu is uniconified. After the selection is made, restore the mouse to where it was. This option is particularly useful when combined with -popdown. EXAMPLE
larsmenu -popup "XTerm:xterm" "Calculator:xcalc" LICENSE
This is a modified version of 9menu, which has this license: --- 9menu is free software, and is Copyright (c) 1994 by David Hogan and Arnold Robbins. Permission is granted to all sentient beings to use this software, to make copies of it, and to distribute those copies, provided that:(1) the copyright and licence notices are left intact(2) the recipients are aware that it is free software(3) any unapproved changes in functionality are either (i) only distributed as patches or (ii) distributed as a new program which is not called 9menu and whose documentation gives credit where it is due(4) the authors are not held responsible for any defects or shortcomings in the software, or damages caused by it. There is no warranty for this software. Have a nice day. --- Please consider my code to be under the same type of license as 9menu, inserting my name where appropriate. SEE ALSO
larsclock(1x), larsremote(1x), larswm(1x) AUTHORS
larsmenu was created by Lars Bernhardsson <lab@fnurt.net> by building on 9menu by David Hogan and Arnold Robbins. LARSMENU(1x)
All times are GMT -4. The time now is 06:00 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy