I did find the solution. When I did echo
of the $DISPLAY
in the same script, it has nothing in it. So, I've set it to my machine display. But this didn't work till I added xhost +
to the script.
The final script would look like:
#!/bin/bash
xhost +
/user/bin/zenity --question --text="question?" --display="myMachine:0.0"