I need help. Im new at bash shell programming, I have task to do. So, I need to make menu and in menu a submenu. I mean, then u press 5 (database management) it has to show submenu with 3 options. I tried some methods with if but I cant get it done. This is my code:
#!/bin/bash
PS3='Please enter your option: '
options=("Buy" "Sale" "Change data" "View cars" "Database management" "Calculate profits" "Sold cars" "Vechiles in stock" "Exit program")
select opt in "${options[@]}"
do
case $opt in
"Buy")
echo "you chose choice 1"
;;
"Sale")
;;
"Change data")
;;
"View cars")
;;
"Database management")
PS3='Please enter your option: '
options=("1" "2" "3")
select opt in "${options[@]}"
do
case $opt in
"1")
echo "you chose choice 1"
;;
"2")
echo "you chose choice 2"
"3")
echo "you chose choice 3"
;;
"Calculate profits")
;;
"Sold cars")
;;
"Vechiles in stock")
;;
"Exit program")
break
;;
*)
echo "invalid option $REPLY"
;;
esac
done
If press 5, it has to pop out another menu with "Back up" "Delete" "Restore" Thank you.