Created
July 10, 2012 14:22
-
-
Save tartley/3083586 to your computer and use it in GitHub Desktop.
prepend a red 'last command exit value' to PS1, only for non-zero values.
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
# display red exit value if it isn't zero | |
PROMPT_COMMAND='EXITVAL=$?; '$PROMPT_COMMAND | |
GET_EXITVAL='$(if [[ $EXITVAL != 0 ]]; then echo -n "\[\e[37;41;01m\] $EXITVAL \[\e[0m\] "; fi)' | |
export PS1="$GET_EXITVAL$PS1" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment