![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| UNIX for Advanced & Expert Users Advanced UNIX and Linux questions go here. Expert-to-Expert. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| help needed in using case statement | jisha | Shell Programming and Scripting | 0 | 01-16-2008 01:33 AM |
| what is problem with this small shell script.. case statement related | johnray31 | Shell Programming and Scripting | 2 | 12-10-2007 12:05 PM |
| case statement | bkan77 | Shell Programming and Scripting | 5 | 09-11-2007 02:54 PM |
| Case Statement | Zeta_Acosta | Shell Programming and Scripting | 19 | 04-06-2004 01:16 PM |
| case statement | Bab00shka | Shell Programming and Scripting | 1 | 07-15-2002 02:31 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
#1
|
|||
|
|||
|
Case statement problem
I need to display this menu and accept variables. Can someone tell me why i am having a problem with this case statement, please
# TAPE MANAGER MAIN MENU tapemgr_Main_Menu() { echo "Legato Tape Management System Menu" echo " This system is used to report Legato ERV Offsite and Tapes Returned" echo " 1. BUR IPS Tape Offsite Report" echo " 2. BUR IPS TAPE Returns from ERV" echo " q. Quit or Ctrl-C" echo "Select an option 1,2,q"; read $1 case $1 in 1) Tapes_Offsite_Menu() ;; 2) Tapes_Return_Menu() ;; q) exit ;; } Tapes_Offsite_Menu() { echo "1. Weekly or Monthly or Both Offsite Reporting (w,m,b)" echo " (W)Weekly (M) for Monthly or (B) for Both x-exit" read SEL case $SEL in w) Weekly_Offsite();; m) Monthly_Offsite();; b) Both_Offsite();; x) tapemgr_Main_Menu();; esac } Tapes_Return_Menu() { echo "Tapes Return Menu" echo " 1. Enter IPS tape (V)olumes or (D)ates to be returned" echo " r) Return to Main Menu" case $SEL in V) Volume_Returns();; D) Volume_Date_Returns();; r) tapemgr_Main_menu();; esac |
| Forum Sponsor | ||
|
|
|
#2
|
||||
|
||||
|
Code:
case $1 in 1) Tapes_Offsite_Menu() ;; 2) Tapes_Return_Menu() ;; q) exit ;; } |
|
#3
|
|||
|
|||
|
I am assuming the user is inputing one of the menu options from the menu screen displayed within the case statement.
# TAPE MANAGER MAIN MENU tapemgr_Main_Menu() { echo "Legato Tape Management System Menu" echo " This system is used to report Legato ERV Offsite and Tapes Returned" echo " 1. BUR IPS Tape Offsite Report" echo " 2. BUR IPS TAPE Returns from ERV" echo " q. Quit or Ctrl-C" echo "Select an option 1,2,q"; read $1 case $1 in 1) Tapes_Offsite_Menu() ;; 2) Tapes_Return_Menu() ;; q) exit ;; } Tapes_Offsite_Menu() { echo "1. Weekly or Monthly or Both Offsite Reporting (w,m,b)" echo " (W)Weekly (M) for Monthly or (B) for Both x-exit" read SEL case $SEL in w) Weekly_Offsite();; m) Monthly_Offsite();; b) Both_Offsite();; x) tapemgr_Main_Menu();; esac } Tapes_Return_Menu() { echo "Tapes Return Menu" echo " 1. Enter IPS tape (V)olumes or (D)ates to be returned" echo " r) Return to Main Menu" case $SEL in V) Volume_Returns();; D) Volume_Date_Returns();; r) tapemgr_Main_menu();; esac |
|
#4
|
|||
|
|||
|
Quote:
|
|
#5
|
||||
|
||||
|
kamitsin said you're missing something in the section here ... see "man ksh" or "man sh" and then search for case ...
Code:
case $1 in 1) Tapes_Offsite_Menu() ;; 2) Tapes_Return_Menu() ;; q) exit ;; esac ... have fun! |
|
#6
|
|||
|
|||
|
duh!! me..I'm so blind. Thank-you..I thought it was there.
|
|
#7
|
||||
|
||||
|
I said that you are missing something because your other two case statements were perfectly ok
|
||||
| Google The UNIX and Linux Forums |
| Thread Tools | |
| Display Modes | |
|
|