Skip to content

Instantly share code, notes, and snippets.

@ali
Created January 18, 2012 00:33
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ali/1630019 to your computer and use it in GitHub Desktop.
Save ali/1630019 to your computer and use it in GitHub Desktop.
Growl Notify for Bash: Runs command & shows Growl notification on completion
#!/bin/bash
# ntf
# Runs the command passed as the argument and shows a Growl notification when it's done.
# Usage: ntf <command>
# Example: `ntf echo hi`
# Requires Growl Notify: http://growl.info/extras.php#growlnotify
# Author: Ali Ukani
GROWLNOTIFY=/usr/local/bin/growlnotify # Location of growlnotify
SUCCESS=0
E_NOARGS=65
if [ -z "$1" ]
then
echo "Need arguments."
echo "Usage: `basename $0` <command>"
exit $E_NOARGS
fi
NTF_MSG="$*"
NTF_TITLE="Finished $1"
# Run the command (arguments)
$@
# Notify when done
$GROWLNOTIFY $NTF_TITLE -m "$NTF_MSG"
exit $SUCCESS
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment