diff --git a/skel/.bashrc b/skel/.bashrc index c1c7c87..e39bee1 100644 --- a/skel/.bashrc +++ b/skel/.bashrc @@ -34,7 +34,7 @@ shopt -s checkwinsize if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then debian_chroot=$(cat /etc/debian_chroot) fi - +$() # set a fancy prompt (non-color, unless we know we "want" color) case "$TERM" in xterm*) color_prompt=yes;; @@ -72,6 +72,15 @@ xterm*|rxvt*) ;; esac +# Add goodies to PS1 +export BASE_PS1="$PS1" +export BASE_PS1="$(echo "$BASE_PS1" | sed 's!\\\$ $!!g')" +export BASE_PS1_END='\$ ' + +# show return value if prompt is nonzero +export BASH_GOODIES_RETURNVAL='$([ "$?" = 0 ] && echo "" || echo " \e[31m\][$?]\[\e[0m\] ")' +PS1="${BASE_PS1}${BASH_GOODIES_RETURNVAL}${BASE_PS1_END}" + # enable color support of ls and also add handy aliases if [ -x /usr/bin/dircolors ]; then test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"