set +x # ======== Custom prompt # Define colors for readability #black="\[\033[0;30;49m\]" #blackgrey="\[\033[30;47m\]" _RED="\[\033[31;49m\]" _GREEN="\[\033[32;49m\]" #yellow="\[\033[33;49m\]" _BLUE="\[\033[34;49m\]" #magenta="\[\033[35;49m\]" #cyan="\[\033[36;49m\]" _WHITE="\[\033[37;49m\]" r_color="\[\033[0m\]" # Reset color #clr="\[\033[K\]" # Clear to the end of the line # Returns short path (last two directories) spwd () { ( IFS=/ set $PWD if test $# -le 3 ; then echo "$PWD" else eval echo \"…\${$(($#-1))}/\${$#}\" fi ) ; } _HOST="@\h" if [ ${UID} -eq 0 ]; then # [[ $SSH_CONNECTION ]] && _HOST="${_HOST}" _USER="$_RED\u$_HOST" else [[ $SSH_CONNECTION ]] && _HOST="${_RED}${_HOST}" _USER="$_GREEN\u$_HOST" fi #[[ -f /tmp/is_a_chroot ]] && PS1="${_WHITE}chroot\:${PS1}" PS1="$_USER [\$(spwd)]$r_color " #$_GREEN if [ -f /tmp/is_a_chroot ]; then PS1="${_WHITE}chroot:${PS1}" fi unset _USER r_color _RED _BLUE _GREEN _HOST _WHITE