Skip to content

Instantly share code, notes, and snippets.

@kitt1987
Created December 11, 2019 09:00
Show Gist options
  • Save kitt1987/267c0f12690a5aa0bee3a19470a753a5 to your computer and use it in GitHub Desktop.
Save kitt1987/267c0f12690a5aa0bee3a19470a753a5 to your computer and use it in GitHub Desktop.
Show notification after executing shell commands.
yell() {
cmd=""
if [ $# -gt 0 ]; then
cmd=$@
else
cmd=$(history| awk '{$1=""; print $0}' | grep -E '^\s*yell.+' | tail -1)
fi
eval $cmd
if [ $? -ne 0 ]; then
terminal-notifier -title '💀' -message "Done- $(echo $cmd) [$(basename `pwd`)]" -sound default
else
terminal-notifier -title '👽' -message "Done- $(echo $cmd) [$(basename `pwd`)]" -sound default
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment