Skip to content

Instantly share code, notes, and snippets.

@ddunbar
Created March 19, 2015 19:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ddunbar/9ff40f853c45f66951b6 to your computer and use it in GitHub Desktop.
Save ddunbar/9ff40f853c45f66951b6 to your computer and use it in GitHub Desktop.
$ 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