Skip to content

Instantly share code, notes, and snippets.

@staltz
Created March 7, 2017 13:08
Embed
What would you like to do?
Show a macOS notification when a terminal task is done
# Name it whatever you want. I like `y` because in my keyboard layout it's close to `;`
function y() {
previous=$?
if [ $previous -eq 0 ]; then
osascript -e "display notification \"Done\" with title \"Terminal Task\"" && say "it is done";
else
osascript -e "display notification \"Failed\" with title \"Terminal Task\"" && say "it went to the trees";
fi
}
npm test ;y
@sebinsua
Copy link

sebinsua commented Mar 7, 2017

@zhangchiqing
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment