Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Dynamic menu selection? Help.. Post 302909651 by malfolozy on Friday 18th of July 2014 06:02:03 AM
Old 07-18-2014
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
lo

However, if there's changes made, for example another network card was added which name lo1. The program will update the changes and allow user to have the latest choice.

eth0
lo
lo1

I am up to here at the moment. guide me guys..
Code:
#!/bin/bash
clear

ifconfig -a | sed -n 's/^\([^ ]\+\).*/\1/p' > somefile

array=($(<somefile))

whiptail --title Networking --menu "select your choice" 16 78 5 "${array[@]}"

Regards,

Malfolozy

Last edited by malfolozy; 07-18-2014 at 07:47 PM.. Reason: code tags please
 

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

Menu help with array selection

Hi there all I got the following I got multiple arrays named for example STAT_AAAA STAT_AAAB STAT_AAAC STAT_AAAD Now what I want I have chosen an option in a menu to select 1 but I dont want to write for all the same thing so I made it a signle one now what I want is to get STAT_ and... (6 Replies)
Discussion started by: draco
6 Replies

4. Linux

Opt out of selection menu?

When I logon to my server with PuTTY I am forced into a selection menu with few options. How to I opt out of this menu to get to the home directory to view all of the files on the server? Thanks for the help. :o (1 Reply)
Discussion started by: ksirimarco
1 Replies

5. UNIX for Dummies Questions & Answers

Input A Menu Selection In A Variable

hey all, me again....having a problem with my code, where I essentially am trying to show a menu, have the user select an option (from 1 to 5), then display which selection they picked... #!/bin/bash # A LIST OF THE ERROR MESSAGES AND THE PROPER SYNTAX: error_0="Correct amount of... (1 Reply)
Discussion started by: SoVi3t
1 Replies

6. Shell Programming and Scripting

reprint the select menu after a selection

Hi, I am using a select in ksh for a script #!/bin/ksh FIRSTLIST='one two three four quit' PS3='Please select a number: ' select i in $FIRSTLIST ; do case $i in one) print 'this is one' ;; two) print 'this is 2' ;; three) print 'this is 3' ;; four) print... (7 Replies)
Discussion started by: omerzzz
7 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

A selection menu in a shell script

I'm writing a shell script and have a problem with selection when I issue the command, is there a way to automatically choose a selection number one after a selection menue appear Command 1-choice 2- choice 3-choice Thanks Sara (3 Replies)
Discussion started by: Sara_84
3 Replies

9. Shell Programming and Scripting

Dialog --menu limitation for the entries for selection

Hi Guys, Please pardon me if this is a silly question, but I have tried to find an answer and going through the man page and failed to get one. I have created a menu driven script with dialog --menu option. Everything is working as expeted, however, it seems that if I have more than 10... (1 Reply)
Discussion started by: ww889
1 Replies
OPENSC-TOOL(1)							   OpenSC tools 						    OPENSC-TOOL(1)

NAME
opensc-tool - generic smart card utility SYNOPSIS
opensc-tool [OPTIONS] DESCRIPTION
The opensc-tool utility can be used from the command line to perform miscellaneous smart card operations such as getting the card ATR or sending arbitrary APDU commands to a card. OPTIONS
--info, -i Print information about OpenSC, such as version and enabled components --atr, -a Print the Answer To Reset (ATR) of the card, output is in hex byte format --name, -n Print the name of the inserted card (driver) --serial Print the card serial number (normally the ICCSN), output is in hex byte format --send-apdu apdu, -s apdu Sends an arbitrary APDU to the card in the format AA:BB:CC:DD:EE:FF... --list-files, -f Recursively lists all files stored on card --list-readers, -l Lists all configured readers --list-drivers, -D Lists all installed card drivers --reader num, -r num Use the given reader number. The default is 0, the first reader in the system. --card-driver driver, -c driver Use the given card driver. The default is auto-detected. --wait, -w Wait for a card to be inserted --verbose, -v Causes opensc-tool to be more verbose. Specify this flag several times to enable debug output in the opensc library. SEE ALSO
opensc-explorer(1) opensc 06/03/2012 OPENSC-TOOL(1)
All times are GMT -4. The time now is 11:54 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy