Last active
October 26, 2017 13:56
-
-
Save goodevilgenius/6006aa9be296868347c307b977fc18f2 to your computer and use it in GitHub Desktop.
[OS X Command-line Notifier] #mac
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
#!/usr/bin/env bash | |
args=() | |
while true; do | |
if [ "$1" = "-title" -o "$1" = "-t" ]; then | |
shift | |
args=( "${args[@]}" with title "\"$1\"" ) | |
shift | |
elif [ "$1" = "-subtitle" -o "$1" = "-st" ]; then | |
shift | |
args=( "${args[@]}" subtitle "\"$1\"" ) | |
shift | |
elif [ "$1" = "-sound" -o "$1" = "-s" ]; then | |
shift | |
args=( "${args[@]}" sound name "\"$1\"" ) | |
shift | |
else | |
break | |
fi | |
done | |
args=( display notification "\"$*\"" "${args[@]}" ) | |
osascript -e "${args[*]}" | |
# Command-line Notifier for OS X | |
# Add to your $PATH, chmod +x it, and then call it like so: | |
# notify.sh [-t "Title"] [-st "Subtitle"] [-s "Sound Name"] Text to display in notification | |
# I've tested it using BASH 4.3 (installed through MacPorts) and 3.2.57 (preinstalled with El Capitan), | |
# and it worked fine with both |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment