Interacting with the User in Shell Scripts

In Chapter 25, “Harnessing the Power of the Shell,” you learned to write shell scripts to perform sequences of commands without user intervention. Sometimes it is also helpful to be able to get user input as a shell script is running—to allow the user of the script to make choices about how tasks will be performed, for example.

The xmessage command can be used in shell scripts to enable the scripts to interact easily with the user via the mouse.

Using xmessage in Shell Scripts

To use xmessage in your shell scripts, you must call it from within a script by using the -buttons option and two arguments: a comma-separated list of buttons and the message that should be displayed to the user above the buttons. ...

Get SAMS Teach Yourself Red Hat® Fedora™ 4 Linux® All in One 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.