Growl Notifications for Shell Task Completion

Solution 1:

You can install growlnotify to do this.

$ ./some_program && growlnotify Title -m Message

Of course you would need to think of this before performing your command. The alternative (I don't know how to achieve this though) would be a Growl notification for every single command, which would be insanely annoying.


To simplify use of growlnotify for your use case, edit ~/bash_profile and add the following:

function long {
    $@
    /usr/local/bin/growlnotify Finished -m 'Done'
}

now you can simply long your_command (similar to sudo). Ctrl-A positions the cursor at the beginning of the line, if you (like me) always type the actual command first and need to add the prefix afterwards.

My bash-fu is unfortunately insufficient to be able to add the command to the growlnotify message


per @mankoff's comment to this answer:

You can simply type while the command is running, it gets executed afterwards. I created the following function for me:

function gn {
    /usr/local/bin/growlnotify Finished -m "$@"
}

Use as gn svn.

Solution 2:

What you need is growlnotify which is a CLI program to trigger growl notifications. You could use it as:

./script.sh;; growlnotify -m "done"

It has a few more knobs you can play with, use growlnotify -h for more info