The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
My menu function amatuer_lee_3 Shell Programming and Scripting 6 05-17-2008 07:19 PM
how to write a wrapper c code to return uid using getuid() function pwd High Level Programming 4 05-13-2008 07:01 AM
PHP function kills my code? l008com Shell Programming and Scripting 10 12-15-2003 08:02 PM
Menu function stuck in a loop? darthur UNIX for Dummies Questions & Answers 2 12-14-2001 12:16 PM

Closed Thread
 
Submit Tools LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 05-17-2008
Registered User
 

Join Date: May 2008
Posts: 53
Stumble this Post!
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
Forum Sponsor
  #2 (permalink)  
Old 05-17-2008
cfajohnson's Avatar
Registered User
 

Join Date: Mar 2007
Location: Toronto, Canada
Posts: 623
Stumble this Post!
Quote:
Originally Posted by amatuer_lee_3 View Post
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 (permalink)  
Old 05-18-2008
era era is online now
Herder of Useless Cats
 

Join Date: Mar 2008
Location: /there/is/only/bin/sh
Posts: 3,607
Stumble this Post!
Quote:
Originally Posted by cfajohnson View Post
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:
a main menu option?

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 (permalink)  
Old 05-18-2008
Moderator
 

Join Date: Feb 2007
Posts: 1,923
Stumble this Post!
I agree with cfajohnson and era, continue here:

insert multiple lines into a file

Thread closed.

Last edited by Franklin52; 05-18-2008 at 04:11 AM.
Google The UNIX and Linux Forums
Closed Thread

Thread Tools
Display Modes




All times are GMT -7. The time now is 04:50 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0