Article 5P6CD Bash script menu looped.

Bash script menu looped.

by
elnetotaca
from LinuxQuestions.org on (#5P6CD)
So here is what I have, and I am very happy with what I have so far, but I do want to add a loop so when a command has been executed, ask for a "ENTER" strike and it will send you back to the menu...

Considerations;
The menu already has a button for "OK" and "CANCEL", where "CANCEL" exits the menu.

Code:#!/bin/bash
cmd=(dialog --keep-tite --menu "Welcome to Ernie's Utility Menu v1.0:" 22 76 16)

options=(1 "Hide Connection"
2 "Disconnect from VPN"
3 "Status of Connection"
4 "Update the system"
5 "Clean up post update mess"
6 "Deep Clean (Trojans and malware)"
7 "Speedometer (Bandwith Monitor)"
8 "Bmon (Bandwith Monitor)"
9 "Test Bandwith speed (up & down)"
10 "Snow in the terminal"
)

choices=$("${cmd[@]}" "${options[@]}" 2>&1 >/dev/tty)

for choice in $choices
do
case $choice in
1)
expressvpn connect
;;
2)
expressvpn disconnect
;;
3)
expressvpn status && nmcli dev wifi
;;
4)
sudo apt update && sudo apt upgrade -y #!//&& sudo apt-get dist-upgrade -y not sure if I want to do this part....
;;
5)
sudo apt update && sudo apt -f install && sudo dpkg --configure -a && sudo apt clean && sudo apt autoremove && sudo -k && exit
;;
6)
sudo chkrootkit -d && sudo rkhunter -c --rwo && sudo -k
;;
7)
speedometer -l -r wlp2s0 -t lo -m $(( 1024 * 1024 * 3 / 2 ))
;;
8)
bmon
;;
9)
speedtest
;;
10)
./snow.sh
;;
esac
done

bashI tried adding:
read -p "Hit enter to continue ..."
exec /bin/bash "$0" "$@"

but then I had to add an option for exit because even if I click on the "CANCEL" button, it sends me back to the menu.
What would be the most smart way to make this better?latest?d=yIl2AUoC8zA latest?i=LQw36fEV-Ho:6dXVZwCl8jc:F7zBnMy latest?i=LQw36fEV-Ho:6dXVZwCl8jc:V_sGLiP latest?d=qj6IDK7rITs latest?i=LQw36fEV-Ho:6dXVZwCl8jc:gIN9vFwLQw36fEV-Ho
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments