Hello everyone, i stuck at this topics
"When a user enters an option at the main menu, you want to take them to the appropriate sub-menu. You can use a case
statement for this. Here’s an example:
case EXPRESSION in
PATTERN) STATEMENTS ;;
PATTERN) STATEMENTS ;;
PATTERN) STATEMENTS ;;
*) STATEMENTS ;;
esac
The expression you want is the $MAIN_MENU_SELECTION
variable. You are expecting it to be a 1
, 2
, or 3
for your various menus. Add a case
statement that takes users to their corresponding menus. The *
is for when anything else is entered. Take users to the MAIN_MENU
when the variable isn’t a 1
, 2
, or 3
."
I’ve been following the hint. This is my code =
#!/bin/bash
echo -e "\n~~~~~ Bike Rental Shop ~~~~~\n"
MAIN_MENU() {
echo "How may I help you?"
echo -e "\n1. Rent a bike\n2. Return a bike\n3. Exit "
read MAIN_MENU_SELECTION
case $MAIN_MENU_SELECTION in
1) RENT_MENU ;;
2) RETURN_MENU ;;
3) EXIT ;;
*) MAIN_MENU ;;
esac
}
RENT_MENU() {
}
RETURN_MENU() {
echo "Return Menu"
}
EXIT() {
echo -e "\nThank you for stopping in.\n"
}
MAIN_MENU
The error notice is “Your script should take you to the various menus and ouput the correct text”
Could you please help me understand why this is happening? I appreciate your attention and help. Thank you.