Send a Notification Badge to the Terminal Dock Icon When a Task is Finished
Not long ago we showed you how to announce when a command line task was finished by using the ‘say’ command, but because it speaks aloud it may be inappropriate to use in a quiet environment. A much more subtle notification takes advantage of Terminal apps new usage of the BEL alert, which in OS X Lion onward pushes a red notification badge to the Dock icon rather than sounding the awful hardware beep.
Adding a notification alert to a completed command is simple, just append “&& tput bel” to the end of a command. For example, to throw the notification alert when the make command is finished running it would look like the following:
make install && tput bel
When finished running, the default system alert will sound, the Terminal dock icon will bounce with a new red notification badge added.
If you want to see it in action in OS X, try it with ping and then go away from the Terminal app:
ping -c 5 www.google.com && tput bel
This can be much better than the “say” alert because it remains useful even when the computer is muted, and it’s more versatile than the Growl notification method since it does not require any additional software to be installed to function. It works in OS X Lion and OS X Mountain Lion.
Thanks to Austin L. for sending this in!