Linux Today: Linux News On Internet Time.

More on LinuxToday

Saving my sanity with Zenity : shell script interaction via the GUI

Feb 05, 2009, 07:34 (0 Talkback[s])
(Other stories by Ryan Cartwright)

WEBINAR: On-demand webcast

How to Boost Database Development Productivity on Linux, Docker, and Kubernetes with Microsoft SQL Server 2017 REGISTER >

[ Thanks to steve hill for this link. ]

"Zenity is not a unique tool (it’s similar to dialog and Xdialog etc.) and not the first of its kind either, but it is very usable. The FSF directory page says that “Zenity lets you display Gtk+ dialog boxes from the command line and through shell scripts” and I can find no better way of summarising it. Put another way though, Zenity allows a shell script to interact with a GUI user in a mutually beneficial way. Sometimes your shell script needs to ask the user a question: Zenity gives them a familiar dialog window and accepts the answer accordingly. The end user need not even be aware that they are running a shell script.

"Hello world!
As mentioned, you can put shell commands into scripts to be executed. The same applies the other way around. You can take a script command and run it directly in the shell if you want. In the case of Zenity this is less useful unless you are doing for testing purposes though. To give a simple example in the standard fashion this is how you would get Zenity to display an information dialog. Assuming you have Zenity installed (it’s a package on most GNU/Linux systems so just search for it in your usual package/software manager), type this directly into a GUI terminal emulator (xterm etc.) and see what you get:"

Complete Story

Related Stories: