Zenity Menu

I have some troubles with zenity and menu.

I seach for:

MAIN MENU
CHOICE 1
"do something"
CHOICE 2
"do something 2"
CHOICE 3
"do something 3"

But then in "do someghing [1-3]" when i click [OK BUTTON] i want to return to the MAIN MENU

So something like:

while true; do
  choice="$(zenity --width=200 --height=150 --list --column "" --title="choice" \
  "CHOICE 1" \
  "CHOICE 2" \
  "CHOICE 3")"

  case "${choice}" in
 

(And then, how to continue from here to

   esac
done

?)

I want to insert a "break function" in any CHOICE

for example:

zenity --info --title "$title" --text "OK BUTTON - RETURN TO THE MAIN MENU"
break
;;
(RETURN TO MAIN MENU)

if your do something is some script then use exec to call that program
and break;; will return to main menu as you wanted if its under infinite while loop

Solved, thank you! :wink:

After some tests I think zenity have some limitations..

So for example:

while true; do
blablabla...
"browser")
exec iceweasel
zenity --info --title "title" --text "text"
;;

open browser then exit from script and ignore zenity call.

but with &

while true; do
blablabla...
"browser")
exec iceweasel &
zenity --info --title "title" --text "text"
#break
;;

works fine: open browser, open window then return to the main menu (with or without break).

Problem:

For example i have this command:

exec curl www.google.com  | sed... | grep ... | others commands > file.txt
if [[ -s file.txt ]] ; then
cat file.txt  | zenity  --text-info

So works fine but then (with OK button) script exit...
I want script return to the main menu when i click OK button after "zenity --text info" ...Any idea?

just to resolve my doubts, can i have more than 3 choices, cos im thinking that we have only three numbers (0,1,-1) to represent the choices. so can i have more choices.

and i used parts of your code to do some testing :

while true; do
choice="$(zenity --width=500 --height=150 --list --column "" --title="choice" \
"Enable " \
"Disable " \
"Quit")"

case $? in
0)
exec script.sh;;
1)
echo "No file selected.";;
-1)
exec exit;;
esac

Note: this will give me execution of script.sh regardless of any choices i made. so i guess im going wrong in some parts.