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 09:02 PM
Menu function stuck in a loop? darthur UNIX for Dummies Questions & Answers 2 12-14-2001 01:16 PM

Closed Thread
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 05-17-2008
Registered User
 

Join Date: May 2008
Posts: 53
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  
Old 05-17-2008
cfajohnson's Avatar
Registered User
 

Join Date: Mar 2007
Location: Toronto, Canada
Posts: 791
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  
Old 05-18-2008
era era is offline
Herder of Useless Cats
 

Join Date: Mar 2008
Location: /there/is/only/bin/sh
Posts: 3,650
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  
Old 05-18-2008
Moderator
 

Join Date: Feb 2007
Posts: 2,291
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 Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 11:12 AM.


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

Content Relevant URLs by vBSEO 3.2.0