I have a cron entry that runs a script at a certain time each day. The script sets the DISPLAY
to :0
and launches a program for the user to run (this is a single-user desktop). I want to change this so that the user first sees a dialog box so he can indicate whether he wants to run the program.
I'm using Ubuntu with Gnome. Is there some kind of dialog box command that can return whether OK or Cancel was clicked? Or is there some other way to get this effect?
You could use Zenity. It allows you to use GTK dialogs, and I think the yes/no ones just store their value in $?. You can use:
if zenity --question --text="Are you sure?"; then
sudo rm -rf / # kidding!
fi
Just like usual.
zenity --question
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With