I found this bash script to make a menu and it is wonderful except I would like it to stay in the script, return back to the menu after something has been selected unless the last option exit has been selected. Also when something is selected the output has to stay shown until a key has been pressed which returns back to the menu.
Can anyone help me out, I would very much appreciate help.
Here is the script
#!/bin/bash
HEIGHT=15
WIDTH=40
CHOICE_HEIGHT=4
BACKTITLE="SOULMASK SERVER MENU"
TITLE="Title here"
MENU="Choose one of the following options:"
OPTIONS=(1 "login info"
2 "Soulmask status"
3 "Option 3"
4 "exit")
CHOICE=$(dialog --clear
--backtitle "$BACKTITLE"
--title "$TITLE"
--menu "$MENU"
$HEIGHT $WIDTH $CHOICE_HEIGHT
"${OPTIONS[@]}"
2>&1 >/dev/tty)
clear
case $CHOICE in
1)
w ; uptime
;;
2)
/usr/bin/systemctl status soulmask
;;
3)
who
;;
4)
exit
;;
esac
I tried putting breaks in, but it gave me syntax errors.
Sunyata Nothing is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.