Created
March 19, 2015 19:44
-
-
Save ddunbar/9ff40f853c45f66951b6 to your computer and use it in GitHub Desktop.
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
$ cat ~/bin/status | |
#!/bin/sh | |
if [ $# -lt 2 ]; then | |
echo "Usage: $(basename $0) <exit-code> <name ...>" | |
echo | |
echo "This script is intended to be used along with a shell alias" | |
echo "such as:" | |
echo " alias status='status $?'" | |
echo "which will automatically add the last exit code." | |
echo | |
echo "Then append 'status <name>' to long running commands to have" | |
echo "OS X tell you when they are complete, for example:" | |
echo " sleep 10; status Sleeping" | |
exit 1 | |
fi | |
status=$1 | |
shift | |
if [ "$status" == 0 ]; then | |
say "\"$*\" is done" | |
exit 0 | |
else | |
say "\"$*\" is done, but it failed" | |
exit 1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment