Multi level submenu, return to previous level and main menu as options
1
vote
2
answers
159
views
I am working on a multi-level menu and I want to implement the ability for sub menus and sub-sub menus to return to the previous menu or go directly back to the main menu. Please see below...
[Menu]
1 - Option 1
2 - Option 2
3 - Quit (exit command)
Please choose option:
#Under Option 1
1 - Sub-Option 1
2 - Sub-Option 2
3 - back to main menu
#Under Sub-Option 1
1 - Sub-sub Option 1
2 - Sub-sub Option 2
3 - back to Sub-option menu
4 - back to main menu
My current code keeps each menu in a separate function. I included my Sub-Option menu below...
suite_menu() {
show_suite_menu
read -p "Pick Number> " choice
case $choice in
1) echo "1 selected."
fullsuite_menu ;;
2) echo "2 selected."
fullsuite_menu ;;
3) echo "3 selected."
fullsuite_menu ;;
0) break;;
*) echo "Invalid choice, please try again";;
esac
}
How could I code my sub-sub-option menu to have option 3 going to the menu above, and option 0 going to main menu?
Thanks in advance <3
Asked by Angela Zhou
(13 rep)
Mar 5, 2025, 04:54 PM
Last activity: Mar 5, 2025, 09:23 PM
Last activity: Mar 5, 2025, 09:23 PM