How to do it...

Zenity is used to add a graphical interface to shell scripts using a single command. Zenity comes by default with Ubuntu. If not, then install it as follows:

$ sudo apt install zenity

First, we will catch a yes/no response in our shell script and then perform different commands based on the button. Run the following command to get the yes/no response.

$ zenity --question --title="Query" --text="Would you like to run the script?"

Run the following command to get the error message box:

$ zenity --error --title="An Error Occurred" --text="A problem occurred while running the shell script."

Run the following command to get the ...

Get Bash Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.