Skip to content

Instantly share code, notes, and snippets.

@stoph
Created November 21, 2014 19:13
Show Gist options
  • Save stoph/5523ca387dde4d7efdcc to your computer and use it in GitHub Desktop.
Save stoph/5523ca387dde4d7efdcc to your computer and use it in GitHub Desktop.
Add osx notifications to CLI scripts
#!/bin/sh
# Save this as /usr/local/bin/notify
# chmod +x /usr/local/bin/notify
#
# Usage:
# sleep 2;notify "I'm awake" Sleepy
if [ "$1" ]
then
MESSAGE="$1"
else
MESSAGE="Done"
fi
if [ "$2" ]
then
TITLE="$2"
else
TITLE="Notify"
fi
/usr/bin/osascript -e "display notification \"$MESSAGE\" with title \"$TITLE\""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment