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

case $1 in
1) Tapes_Offsite_Menu()
;;
2) Tapes_Return_Menu()
;;
q) exit
;;
}

You are missing something here !!!!!!!

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

Thank-you for your response. I am trying to get option input from the menu, and then go to the function for that option. The problem is that I cannot get the menu to display to select the option and the function.

kamitsin said you're missing something in the section here ... see "man ksh" or "man sh" and then search for case ...

case $1 in
1) Tapes_Offsite_Menu()
;;
2) Tapes_Return_Menu()
;;
q) exit
;;
esac

... have fun!

duh!! me..I'm so blind. Thank-you..I thought it was there.

I said that you are missing something because your other two case statements were perfectly ok :slight_smile: so i thought you will find it out :smiley: