My menu function [new code -revised]


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting My menu function [new code -revised]
# 1  
Old 05-17-2008
My menu function [new code -revised]

Below is my menu options code. It allows user to pick one of two option. I can get the first option to work, because if it is selected it just "breaks" and carries on with the script.

What i want to know is if a user selects option two how do i get that option to ignore all the other script and go to another specific part to carry out other commands??? ( i have indicated the problem by putting ########)

Code:
while true; do
    echo " "        
    echo "Main Menu: "
    echo "Please Select An Option Using The Options Provided."
    echo " "        
    echo "1 - Search All Files"
    echo " "        
    echo "2 - Idex Page Information"
        echo " "
        echo "Q - Quit"
        echo " "
        echo "Please enter your option: "
        read CHOSEN_KEY
        case $CHOSEN_KEY in
                [1])    echo " "
            echo "You Have Selected To Search All Files For Hits"
                        break;;                               # By using break i carry on my script which works correctly.
                [2])    echo " "
            echo "You Have Selected To Access Index Page Information"
                      ######;;
                Q|q)    echo " "
            echo "Goodbye"
                        exit;;
        esac
done

# 2  
Old 05-17-2008
Quote:
Originally Posted by amatuer_lee_3
Below is my menu options code. It allows user to pick one of two option. I can get the first option to work, because if it is selected it just "breaks" and carries on with the script.

Please don't start a new thread for the same problem.
Quote:
What i want to know is if a user selects option two how do i get that option to ignore all the other script and go to another specific part to carry out other commands??? ( i have indicated the problem by putting ########)

Please read my post in the original thread (especially the part about organizing the script with functions).
# 3  
Old 05-18-2008
Quote:
Originally Posted by cfajohnson
Please read my post in the original thread (especially the part about organizing the script with functions).
There is not just one "original thread". Here's another where I tried to suggest the same thing:
https://www.unix.com/shell-programmin...nu-option.html

amatuer_lee_3: if the earlier replies you get are not understandable, please ask about the parts you don't understand, rather than start new mutant threads.
# 4  
Old 05-18-2008
I agree with cfajohnson and era, continue here:

https://www.unix.com/shell-programmin...#post302196382

Thread closed.

Last edited by Franklin52; 05-18-2008 at 08:11 AM..
Login or Register to Ask a Question

Previous Thread | Next Thread

7 More Discussions You Might Find Interesting

1. What is on Your Mind?

Revised Tooltips for Thread Views Using Bootstrap

See attached screen movie that demos the revised tooltips which includes thread previews, or double click on the YT video below to go to YT and view in full screen mode, etc: HkObCAYg6LI (0 Replies)
Discussion started by: Neo
0 Replies

2. Shell Programming and Scripting

Execute function as soon as input is provided in menu drive shell script

Hi All, I have a menu driven scripts. As you know while running the script we have to input the option such as 1,2, and 3 to execute function accordingly. but after selecting the input we have to press Enter. My requirement is to execute function as soon as we press the option. Is there... (5 Replies)
Discussion started by: kiran_j
5 Replies

3. Shell Programming and Scripting

Special case to skip function in bash menu

In the bash menu below if the variant that is inputted is in the format NM_004004.3:c.274G>T the below works perfectly. My question is if the variant inputted isNM_004004.3:-c.274G>T or NM_004004.3:+c.274G>T then the code as is will throw an error due to a biological issue. Is it possible to to... (1 Reply)
Discussion started by: cmccabe
1 Replies

4. Shell Programming and Scripting

KSH- perform a function if user selects option from menu

Hi, I have a script that copies a file from one directory to another and compiles it. What I have now is a menu that calls functions and each function compiles the file. I want to have a function that compiles the file at the end of the script if the user selects options 1-3 in the menu, but... (0 Replies)
Discussion started by: amitlib
0 Replies

5. Shell Programming and Scripting

Need to remove first character from every third line (or revised nawk).

Here's the data I'm starting with (example output of two combined queries, filesize: 284k) 3000877|555-55-1111|2|7/30/2008|TEST|P.O. BOX 1111|PALM DESERT|CA|92211||5555555555||||||||48|||1||1|3|||2|||||||||||||1|3||2|2... (6 Replies)
Discussion started by: VPREATR
6 Replies

6. Shell Programming and Scripting

My menu function

Below is my menu options code. It allows user to pick one of two option. I can get the first option to work, because if it is selected it just "breaks" and carries on with the script. What i want to know is if a user selects option two how do i get that option to ignore all the other script and... (6 Replies)
Discussion started by: amatuer_lee_3
6 Replies

7. UNIX for Dummies Questions & Answers

Menu function stuck in a loop?

I having problem when I call this cleanupmenu function within a script. It continuously loops and goes to selection * That wasn't a valid selection. I have to kill it everytime to stop it. What am I doing wrong. I use this function menu in several other scripts and I don't have this problem at... (2 Replies)
Discussion started by: darthur
2 Replies
Login or Register to Ask a Question