Sep
4th
Fri
4th
NEAT-O: bash + Growl == love
If you’re not familiar with Growl, it’s a non-intrusive little notification system for OSX:
Now, check out this Gist:
function n {
"$@"
status=$?
if [ "$status" == "0" ] ; then
result="completed"
else
result="FAILED ($status)"
fi
growlnotify -m "Script $result" -s "$@"
}
This snippet of bash shell scripting will use Growl to notify you when a long-running command completes. Simply slap that snippet into your .profile, open a new shell (or run “source ~/.profile” in an existing one), run “n yourcommandhere” and blammo!
For even more shell sexiness, be sure to check out Visor, a Quake-style OSX terminal that pops down with the stroke of a keycombo:
(Thanks to Sean for pointing this out to me.)
/edit “growlnotify” is not included in a default Growl installation. Look on the Growl installation image under “Extras/growlnotify” folder for “install.sh”