这就是我所拥有的,我对到目前为止所拥有的非常满意,但是我确实想添加一个循环,所以当一个命令被执行时,请求一个"ENTER“回击,它会把你送回菜单……
#!/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发布于 2021-09-04 03:03:41
在脚本末尾添加:
read -p "Hit enter to continue ..."
exec /bin/bash "$0" "$@"exec命令将重新执行脚本,重新使用当前进程。
发布于 2021-09-08 23:01:28
所以,如果有人对回收菜单感兴趣.这就是我的最终产品的样子;
#!/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"
# 11 "exit"
)
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
;;
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
;;
*)
exit
esac
read -p "Hit enter to continue ..."
exec /bin/bash "$0" "$@"
donehttps://askubuntu.com/questions/1361811
复制相似问题