10 Tools To Add Some Spice To Your UNIX/Linux Shell Scripts

Originally published at: https://www.cyberciti.biz/tips/spice-up-your-unix-linux-shell-scripts.html

There are some misconceptions that shell scripts are only for a CLI environment. You can efficiently use various tools to write GUI and network (socket) scripts under KDE or Gnome desktops. Shell scripts can make use of some of the GUI widget (menus, warning boxes, progress bars, etc.). You can always control the final output, cursor position on the screen, various output effects, and more. With the following tools, you can build powerful, interactive, user-friendly UNIX / Linux bash shell scripts.

Thank you for your awesome article!!!

I would inform you that under Linux Mint 18.3 (based upon Ubuntu 16.04), the notify send does not work under CRON, not event setting the DISPLAY variable.

Is there another workaround?

Thank you so much,
Antonio

Try something as following in cron:

DISPLAY=:0 DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus /usr/bin/notify-send "This is a test."

Where, 1000 is your user id and it can be located with id command:

id -u

For sudo try (run it as foo user with id 2000):

/usr/bin/sudo -u foo DISPLAY=:0 DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/2000/bus /usr/bin/notify-send 'Hello world!' 'I am running and doing something for you.'

journalctl -f --user will follow the user’s log on a Fedora 27.