-
-
Save ali/1630019 to your computer and use it in GitHub Desktop.
Growl Notify for Bash: Runs command & shows Growl notification on completion
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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