The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Operating Systems > Linux > Google Chrome OS
.
google unix.com



Google Chrome OS Coming soon! Google Chrome Operating System. It's free!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
How to ignore STDERR when nesting commands? Smiling Dragon Shell Programming and Scripting 3 04-30-2009 10:17 PM
Isn't a shell found on a beach? Need help nesting if's or loops. switchkill UNIX for Dummies Questions & Answers 3 09-01-2008 08:19 PM
Script needed to select and delete lower case and mixed case records abhilash mn Shell Programming and Scripting 1 03-17-2008 08:00 AM
zip nesting empty folders groundlevel UNIX for Dummies Questions & Answers 0 09-28-2006 11:08 PM
lower case to upper case string conversion in shell script dchalavadi UNIX for Dummies Questions & Answers 3 05-29-2002 12:07 AM

Reply
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 10-05-2009
frankycool frankycool is offline
Registered User
  
 

Join Date: Sep 2009
Posts: 5
Post Case Nesting

sdfdefgsrg

Last edited by frankycool; 10-06-2009 at 07:26 AM.. Reason: nothin
  #2 (permalink)  
Old 10-05-2009
pravin27 pravin27 is offline
Registered User
  
 

Join Date: Sep 2009
Location: UAE
Posts: 35
Hi,

Try this


Code:
#!/bin/bash

  clear
            # display menu

         echo "-------------------------------"
         echo "       Superman Restaurant"
         echo "-------------------------------"
         echo "            Main Menu"
         echo "-------------------------------"
         echo "   $(date)"
         echo "-------------------------------"
         echo "1. Display Meal Menu."
         echo "2. Display Drinks."
         echo "3. Display Desert."
         echo "4. Exit"
            # get input from the user

         read -p "Enter your choice [ 1 -4 ] " choice
            # make decision using case..in..esac
         case $choice in
                  1)
                            clear
         echo "-------------------------------"
         echo "       Superman Restaurant"
         echo "-------------------------------"
         echo "            Meal Menu"
         echo "-------------------------------"
         echo
         echo "1. Chichen Fried Rice    10RM."
         echo "2. Tom Yam Fried Rice    15RM."
         echo "3. Lovers Rice           10RM."
         echo "4. Curry Rice            12RM."
         echo "5. Jelof Rice            15RM."
         echo "6. Fairy Rice            10RM."
         echo "7. Spicy Stew Rice       18RM."
         echo "8. Exit"


         read -p "Enter your choice [ 1 -7 ] " Meal
         case $Meal in
         1) meal.txt
         Chichen Fried Rice > meal.txt
         echo " You Just Selected Chichen Fried Rice"
read -p "Press [Enter] to continue order..."

         if $readEnterKey true
         then

         echo
         echo "Your Order has been Completed"
         else
         echo ""
         fi
         ;;
         2)
         echo " You Just Selected Tom Yam Fried Rice"

         read -p "Press [Enter] to continue order..."
         if $readEnterKey true
         then

         echo
         echo "Your Order has been Completed"
         else
         echo ""
         fi
         ;;
         3)
         echo " You Just Selected Lovers Rice"
         read -p "Press [Enter] to continue order..."
         if $readEnterKey true
         then
         echo
         echo "Your Order has been Completed"
         else
         echo ""
         fi
        ;;
         4)
         echo " You Just Selected Curry Rice"
         read -p "Press [Enter] to continue order..."
         if $readEnterKey true
         then
         echo
echo "Your Order has been Completed"
         else
         echo ""
fi
         ;;
         5)
         echo " You Just Selected Jelof Rice"

         read -p "Press [Enter] to continue order..."
         if $readEnterKey true
         then

         echo
         echo "Your Order has been Completed"
         else
         echo ""
fi
         ;;
                 6)
         echo " You Just Selected Fairy Rice"

         read -p "Press [Enter] to continue order..."
         if $readEnterKey true
         then

         echo
         echo "Your Order has been Completed"
         else
         echo ""
fi
         ;;
                 7)
        echo " You Just Selected Spicy Rice"

         read -p "Press [Enter] to continue order..."
         if $readEnterKey true
         then

         echo
         echo "Your Order has been Completed"
         else
         echo ""
fi
;;
                  8)

          echo "Bye!"
                                  exit 0
                                  ;;
          *)
             echo "Error: Invalid option..."
             read -p "Press [Enter] key to continue..."

                                  ;;

esac
;;
                 2)
                            clear
         echo "-------------------------------"
         echo "       Superman Restaurant"
         echo "-------------------------------"
         echo "            Drinks Menu"
         echo "-------------------------------"
         echo
         echo "1. Kikapo Juice     2RM."
         echo "2. Orange Juice     3RM."
         echo "3. Apple Juice      3RM."
         echo "4. Lemon Ice Tea    1RM."
         echo "5. Mango Lassi      5RM."
         echo "6. Herba Tea        2RM."
         echo "7. Cococola         2RM"
         echo "8. Bye!"
         read -p "Enter your choice [ 1 -8 ] " Drinks
         case $Drinks in
             1)
         echo " You Just Selected Kikapo Juice"

         read -p "Press [Enter] to continue order..."

         if $readEnterKey true
         then

         echo
         echo "Your Order has been Completed"
 else
         echo ""
         fi
        ;;
          2)
         echo " You Just Selected Orange Juice"

         read -p "Press [Enter] to continue order..."

         if $readEnterKey true
         then

         echo
         echo "Your Order has been Completed"
         else
         echo ""
fi
;;
         3)echo " You Just Selected Apple Juice"
         read -p "Press [Enter] to continue order..."

         if $readEnterKey true
         then

         echo
         echo "Your Order has been Completed"
         else
         echo ""
fi
;;
          4)echo " You Just Selected Lemon Juice"
         read -p "Press [Enter] to continue order..."

         if $readEnterKey true
         then

         echo
         echo "Your Order has been Completed"
         else
         echo ""
fi
;;
 5)echo " You Just Selected Mango Juice"
         read -p "Press [Enter] to continue order..."

         if $readEnterKey true
         then

         echo
         echo "Your Order has been Completed"
         else
         echo ""

fi
;;
         6)echo " You Just Selected Herbal Tea"
         read -p "Press [Enter] to continue order..."

         if $readEnterKey true
         then

         echo
         echo "Your Order has been Completed"
         else
         echo ""
fi
;;
         7)echo " You Just Selected Cocacola"
         read -p "Press [Enter] to continue order..."

         if $readEnterKey true
         then

         echo
         echo "Your Order has been Completed"
         else
         echo ""
fi
;;
         8)echo "Bye!"
                                  exit 0
                                  ;;
          *)
             echo "Error: Invalid option..."
 read -p "Press [Enter] key to continue..."

                                  ;;
            esac
;;
                            3)

                            clear
         echo "-------------------------------"
         echo "       Superman Restaurant"
         echo "-------------------------------"
         echo "            Desert Menu"
         echo "-------------------------------"
         echo
         echo "1. Ferry Cake               15RM."
         echo "2. Chocolate ice Cream      10RM."
         echo "3. Vanilla Cake             13RM."
         echo "4. Queen Cake               12RM."
         echo "5. Bye!"
         read -p "Enter your choice [ 1 -5 ] " Desert
         case $Desert in
             1)
         echo " You Just Selected Ferry Cake"

         read -p "Press [Enter] to continue order..."

         if $readEnterKey true
         then

         echo
         echo "Your Order has been Completed"
         else
         echo ""
fi
;;
          2)
         echo " You Just Selected Chocolate ice Cream"

         read -p "Press [Enter] to continue order..."
if $readEnterKey true
         then

         echo
         echo "Your Order has been Completed"
         else
         echo ""
fi
;;
         3)
         echo " You Just Selected Vanilla Cake"

         read -p "Press [Enter] to continue order..."

         if $readEnterKey true
         then

         echo
         echo "Your Order has been Completed"
         else
         echo ""
fi
;;
          4)
        echo " You Just Selected Queen Cake"

         read -p "Press [Enter] to continue order..."

         if $readEnterKey true
         then

         echo
         echo "Your Order has been Completed"
         else
         echo ""

fi
;;
         5)


          echo "Bye!"
                                  exit 0
                                  ;;
          *)
             echo "Error: Invalid option..."
             read -p "Press [Enter] key to continue..."

                                  ;;
            esac
;;

          4)

           echo "Bye!"
                                  exit 0
                                  ;;
          *)
             echo "Error: Invalid option..."
             read -p "Press [Enter] key to continue..."

                                  ;;



esac
  #3 (permalink)  
Old 10-05-2009
ahmad.diab's Avatar
ahmad.diab ahmad.diab is offline
Registered User
  
 

Join Date: May 2008
Location: Amman Jordan in MEA
Posts: 227
kindly find below the case command syntax:-

Code:

case "$variable" in
"$condition1" )
command...
;;
"$condition2" )
command...
;;
esac

Notes:-
1-Each test line ends with a right paren ).
2-Each condition block ends with a double semicolon ;;.
3-The entire case block terminates with an esac (case spelled backwards).
4-Quoting the variables is not mandatory, since word splitting does not take
place.
Sponsored Links
Reply

Bookmarks

Tags
case, nesting, restaurant, shell script, simulator

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 07:28 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0