Last Updated: February 25, 2016
· filosottile

Play sounds based on command result

If you start long commands you might want to get warned by a sound when one finishes.

On Mac OSX you can do like this

command; afplay /System/Library/Sounds/Ping.aiff

to get notified of when a command finishes.

If you also want to have a feedback based on whether the command succeeded or not:

command && afplay /System/Library/Sounds/Glass.aiff || afplay /System/Library/Sounds/Basso.aiff

Bonus: switch afplay xxx for say "something" to have the computer actually tell you when it's done!

Say Thanks