Created
June 24, 2017 20:09
-
-
Save AnrDaemon/2148402d96faae335bb762b280554f3a to your computer and use it in GitHub Desktop.
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
__set_prompt() | |
{ | |
test "$PS_ORIG" || PS_ORIG="$PS1" | |
test "$PC_ORIG" || eval "PC_ORIG='$PROMPT_COMMAND'" | |
PROMPT_COMMAND=__bash_prompt | |
}; readonly -f __set_prompt | |
__bash_prompt() | |
{ | |
local ERRORLEVEL=$? | |
if [ $ERRORLEVEL != 0 ]; then | |
ERRORLEVEL="\n[$(tput setaf 1)$ERRORLEVEL$(tput sgr0)]" | |
else | |
ERRORLEVEL= | |
fi | |
eval "$PC_ORIG" | |
[ "$PS_ORIG" ] && PS1="$ERRORLEVEL$PS_ORIG" | |
}; readonly -f __bash_prompt | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment