You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# enable programmable completion features (you don't need to enable
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
# sources /etc/bash.bashrc).
if [ -f /etc/bash_completion ] && ! shopt -oq posix; then
. /etc/bash_completion
fi
COLOR_RED="\[\e[31;40m\]"
COLOR_GREEN="\[\e[32;40m\]"
COLOR_YELLOW="\[\e[33;40m\]"
COLOR_BLUE="\[\e[34;40m\]"
COLOR_MAGENTA="\[\e[35;40m\]"
COLOR_CYAN="\[\e[36;40m\]"
COLOR_RED_BOLD="\[\e[31;1m\]"
COLOR_GREEN_BOLD="\[\e[32;1m\]"
COLOR_YELLOW_BOLD="\[\e[33;1m\]"
COLOR_BLUE_BOLD="\[\e[34;1m\]"
COLOR_MAGENTA_BOLD="\[\e[35;1m\]"
COLOR_CYAN_BOLD="\[\e[36;1m\]"
COLOR_NONE="\[\e[0m\]"
promptFunc()
{
PREV_RET_VAL=$?
PS1=""
chroot="${debian_chroot:+($debian_chroot)}"
# Update window title (with external override)
title="${WINDOW_TITLE:-\u@${chroot}\h: \w}"
PS1="\[\e]0;${title}\a\]"
# Current directory
PS1="${PS1}${COLOR_YELLOW_BOLD}\w${COLOR_NONE}"
# Current git prompt
PS1="${PS1}\$(__git_ps1 ' ${COLOR_BLUE_BOLD}(%s)${COLOR_NONE}')"
if test $PREV_RET_VAL -ne 0
then
PREV_RET_VAL_name="${PREV_RET_VAL}"
if test $PREV_RET_VAL -gt 128
then
# This is a signal death, report it
PREV_RET_VAL_signal=$(( $PREV_RET_VAL - 128 ))
PREV_RET_VAL_signal=$(kill -l $PREV_RET_VAL_signal 2>/dev/null)
if [ -n "$PREV_RET_VAL_signal" ]; then
PREV_RET_VAL_name="${PREV_RET_VAL}: SIG${PREV_RET_VAL_signal}"
fi
fi
PS1="${PS1} ${COLOR_RED_BOLD}[${PREV_RET_VAL_name}]${COLOR_NONE}"
fi
# New line
PS1="${PS1}\n"
# Current time
PS1="${PS1}\$(date +"%H:%M") "
# User (be loud about being root)
if test `whoami` != "root"
then
PS1="${PS1}${COLOR_CYAN_BOLD}\u${COLOR_NONE}"
else
PS1="${PS1}${COLOR_RED_BOLD}\u${COLOR_NONE}"
fi
# Host (with chroot override)
PS1="${PS1}@${chroot}\h"
# Command prompt end
PS1="${PS1}${COLOR_GREEN_BOLD}"'\$'"${COLOR_NONE} "
}
PROMPT_COMMAND=promptFunc