Sponsored Content
Top Forums Shell Programming and Scripting Building a dynamic UNIX menu with input files Post 302983040 by cpolikowsky on Wednesday 5th of October 2016 06:16:58 PM
Old 10-05-2016
Building a dynamic UNIX menu with input files

Hi!

I am looking to build dynamic menu (named: lookup.sh) that reads a pipe delimited file for input.

for example, contents of input.txt could be:
Code:
user1|srv1
user3|srv1
user4|srv1
user2|srv2

I want the menu look like:
Code:
1) get password for user1 on srv1
2) get password for user3 on srv1
3) get password for user4 on srv1
4) get password for user2 on srv2
Choose Option:

then if you choose option #1, it would cat pass_user1_srv1.txt to provide the password.

the key thing I am trying to accomplish is that I don't want to modify lookup.sh when i add a new option. i want to go to the input.txt file and add a line to that and it will be read in the next time lookup.sh is run.

will a bash array work? I am not too familiar with them.

Any ideas?
Any help would be greatly appreciated!
Chris

Last edited by Scrutinizer; 10-05-2016 at 07:32 PM.. Reason: code tags
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

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

2. UNIX for Advanced & Expert Users

building flat files in unix and importing them from windows

what is a flat file in unix? i have to import a unix flat files from windows based programme. my question is not to export from unix but only to import from windows only. how to build that flat files? how to create export to windows how to import from windows (3 Replies)
Discussion started by: tunirayavarapu
3 Replies

3. 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

4. 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

5. Shell Programming and Scripting

building output file from multiple input files

Hi there, I am trying to figure out a way to combine multiple sources with different data on a single file, and I am trying to find the best way to do it. I have multiple files, let's say A, B, C and D. A has a field in common with B, B has a field in common with C, and C has a field in... (2 Replies)
Discussion started by: ppucci
2 Replies

6. Shell Programming and Scripting

Assigning values to reference variables for a dynamic menu driven script.

How do I assign values to reference variables? I am assigning a variable name to --> $user_var Then I am trying to change its underlying variable value by $((user_var))=$user_value .. its failing,, Please let me know if there is a way to do this dynamically.. FileA.props... (5 Replies)
Discussion started by: kchinnam
5 Replies

7. 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

8. Shell Programming and Scripting

Creating Dynamic Input or daa files

Hi, I got a requirement to automate the process. We have SLA files, there are some 80 SLA files comes from 1.30pm - 5.30pm. I was asked to write a script to check for the SLA files in the load directory, if the files come then we got to send the mail to the group, if the mails doesnt come... (1 Reply)
Discussion started by: afahmed
1 Replies

9. 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
DH_INSTALLMENU(1)						     Debhelper							 DH_INSTALLMENU(1)

NAME
       dh_installmenu - install Debian menu files into package build directories

SYNOPSIS
       dh_installmenu [debhelperoptions] [-n]

DESCRIPTION
       dh_installmenu is a debhelper program that is responsible for installing files used by the Debian menu package into package build
       directories.

       It also automatically generates the postinst and postrm commands needed to interface with the Debian menu package. These commands are
       inserted into the maintainer scripts by dh_installdeb(1).

FILES
       debian/package.menu
	   Debian menu files, installed into usr/share/menu/package in the package build directory. See menufile(5) for its format.

       debian/package.menu-method
	   Debian menu method files, installed into etc/menu-methods/package in the package build directory.

OPTIONS
       -n, --no-scripts
	   Do not modify postinst/postrm scripts.

SEE ALSO
       debhelper(7) update-menus(1) menufile(5)

       This program is a part of debhelper.

AUTHOR
       Joey Hess <joeyh@debian.org>

11.1.6ubuntu2							    2018-05-10							 DH_INSTALLMENU(1)
All times are GMT -4. The time now is 04:23 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy