4

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?

2 Answers 2

8

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.

4

zenity --question

Not the answer you're looking for? Browse other questions tagged or ask your own question.