logo
Interact graphically in bash script
xmessage

Interact graphically in bash script

xmessage

Most *nix computers are equipped with xmessage Software, it can recover the choices made by the user graphically. The following code will display a dialog box with two buttons and a little text.
xmessage -buttons Yes,No -center "Are you sure you want to do that?"
You will find if you look at the return code for example with the following command:
echo $?
the return value is 1 if left clicking on the cross, 101 if you click 'Yes' and 102 if you click 'No'.
In fact the first button returns 101, the second 102...
Use this return code as you wish.
Be The First To Comment.

Add a comment:





You can use these HTML tags: <br><a><i><b>