Created
December 6, 2013 03:13
-
-
Save divad12/7817989 to your computer and use it in GitHub Desktop.
Announces and displays exit code of last run command. Try `sleep 5; notify`
This file contains hidden or 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
# Announces and displays exit code of last run command. | |
# eg. `sleep 5; notify` | |
function notify { | |
status=$? | |
if [ $status -eq 0 ]; then | |
echo -e "\033[1;32m[ DONE ]\033[0m" | |
( say -v Cellos `printf "%0.s done" {1..26}` & ) | |
elif [ $status -ne 130 ]; then # Ignore exit with Ctrl-C | |
echo -e "\033[1;31m[ ERROR $status ]\033[0m" | |
( say "Oh noes, exit code $status" & ) | |
fi | |
return $status | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment