Greater Comfort
From simple queries to complex menus: Using dialog, you can create a graphical interface for shell scripts with only a few extra lines of code.
|
Christopher Hall, Fotolia
From simple queries to complex menus: Using dialog, you can create a graphical interface for shell scripts with only a few extra lines of code.
The shell by itself is already an application programming interface, but few users still query data from a command line. To adapt to the habits of current users, the dialog tool simulates the elements of a graphical interface.
The look may be a bit old-fashioned but, in terms of speed, the technology is hard to beat. If an X server is running on the system, you can provide users some additional comfort by relying on a dialog counterpart, such as Zenity or Gtkdialog (see the "Relatives" box).
To read user input, the built-in Bash read command is often used together with the echo command for simple strings. If you want to change the input prompt, enter the -p option with the new text (Listing 1).
[...]
Pages: 8
Programming loops allow one-time or multiple execution of instructions. The condition for the loop can exist both outside and inside it.
Not every window manager provides a program for managing a clipboard. With Zenity and a script, you can comfortably control Xclip from anywhere.
Bring your videos into the limelight and turn your recordings into minor works of art with the OpenShot editing tool.
With just a few lines of shell code, you can build a flexible and easily adaptable stream player.
A database without a search function is like a car without an engine. The second part of our Base series is dedicated to implementing a database search.
© 2025 Linux New Media USA, LLC – Legal Notice