diff options
-rw-r--r-- | .bashrc | 16 |
1 files changed, 15 insertions, 1 deletions
@@ -2,6 +2,9 @@ # ~/.bashrc # +# vim: shiftwidth=4 tabstop=4 expandtab + + # If not running interactively, don't do anything [[ $- != *i* ]] && return @@ -30,5 +33,16 @@ parse_git_branch() { git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/' } -PS1='[\u@\h$(parse_git_branch) \W]\$ ' +get_nonzero_retcode() { + retcode=$? + if [ "${retcode}" -eq "0" ] + then + true + else + echo " ${retcode} " + fi +} + +PS1='[\e[31m$(get_nonzero_retcode)\e[0m\e[32;1m$(date +"%H:%M:%S")\e[0m \e[35;1m\u@\h\e[0m\e[33;1m$(parse_git_branch)\e[0m \e[36;1m\W\e[0m] +$ ' |