Dynamic menu selection? Help..


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Dynamic menu selection? Help..
# 8  
Old 07-19-2014
I would use the number in the second column so that the value that you obtain is the name of the interface (and so then you do not need a case statement).. Otherwise you just get a number and how would you relate that to the interface?

Last edited by Scrutinizer; 07-19-2014 at 07:52 AM..
This User Gave Thanks to Scrutinizer For This Post:
# 9  
Old 07-19-2014
Hmm, i don't get what you mean, sry my english is bad.

So, i went to try something like this,

Code:
CHOICE=$(cat somefile)

case $CHOICE in

"$(cat somefile)") whiptail --msgbox  "$(ifconfig $1)" 20 78 5 ;;

esac

and the output turn out to be it show all the network card info.
# 10  
Old 07-19-2014
There are two fields for every menu item in whiptail. The first field is the choice that will be returned after selection, the second field is just a description..

So then you could just use:
Code:
whiptail --msgbox  "$(ifconfig $CHOICE)" 20 78 5

and you do not need a case statement..
This User Gave Thanks to Scrutinizer For This Post:
# 11  
Old 07-19-2014
Hello,

It doesn't work, because my CHOICE read the first field which is "1." instead of "eth0".

I use

Code:
2>somefile

and it read the first field.

How do i go about doing it so that it read the second field?
# 12  
Old 07-19-2014
That is because 1. is in the first field, you should use it in the second field, see my example in post #6 .
This User Gave Thanks to Scrutinizer For This Post:
# 13  
Old 07-19-2014
Ahh!!!! It works!

So, the only way to do it is to change the position. got it!!

Thanks a lot for guiding me through!! Appreciate it!!


Thanks,

Malfolozy
 
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

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

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

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

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

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

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

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

9. 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
Login or Register to Ask a Question