Skip to content

Instantly share code, notes, and snippets.

@cmittendorf
Last active August 29, 2015 14:04
Show Gist options
  • Save cmittendorf/9d3c33023f4f2917f8ff to your computer and use it in GitHub Desktop.
Save cmittendorf/9d3c33023f4f2917f8ff to your computer and use it in GitHub Desktop.
A little snippet showing how to create a log function in bash that displays its log message in the Mac OS X notification center as well as on the console.
#!/usr/bin/env bash
function log()
{
echo `date +"[%d.%m.%Y %H:%M:%S] "`$1
# Available Sounds:
# Basso, Blow, Bottle, Frog, Funk, Glass, Hero,
# Morse, Ping, Pop, Purr, Sosumi, Submarine, Tink
osascript << EOF
display notification "$1" with title "`basename $0`" sound name "Submarine"
EOF
return
}
log "$*"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment