T here are some misconceptions that shell scripts are only for a CLI environment. You can easily use various tools to write GUI and/or network (socket) scripts under KDE or Gnome desktops. Shell scripts can make use of some of the GUI widget (menus, warning boxs, progress bars etc). You can always control the final output, cursor position on screen, various output effects, and so on. With the following tools you can build powerful, interactive, user friendly UNIX / Linux bash shell scripts.
Creating GUI application is not just expensive task but task that takes time and patience. Luckily, both UNIX and Linux ships with plenty of tools to write beautiful GUI scripts. The following tools are tested on FreeBSD and Linux operating systems but should work under other UNIX like operating systems.
#1: notify-send Command
The notify-send command allows you to send desktop notifications to
the user via a notification daemon from the command line. This is useful
to inform the desktop user about an event or display some form of
information without getting in the user's way. You need to install the
following package:$ sudo apt-get install libnotify-bin
In this example, send simple desktop notification from the command line, enter:
?
notify-send "rsnapshot done :)"
?
Sample outputs:
Here is another code with additional options:
? .... alert= 18000 live= $( lynx --dump http://money.rediff.com/ | grep 'BSE LIVE' | awk '{ print $5}' | sed 's/,//g;s/\. [0-9]*//g' ) [ $notify_counter -eq 0 ] && [ $live -ge $alert ] && { notify-send -t 5000 -u low -i "BSE Sensex touched 18k" ; notify_counter= 1 ; } ...
Sample outputs: