Status indicator in prompt

This commit is contained in:
Meutel 2017-05-01 10:37:29 +02:00
parent 8616383485
commit fc2d7aa952

16
_bashrc
View File

@ -35,10 +35,18 @@ xterm-color)
;;
esac
# Comment in the above and uncomment this below for a color prompt
#PS1='${debian_chroot:+($debian_chroot)}\[\033[0;32m\]\u@\h\[\033[00m\] \[\033[01;34m\]\w\[\033[00m\]\n\$ '
prompt_status()
{
if [[ "$?" == "0" ]]
then
echo -n '\[\033[1;32m\]>'
else
echo -n '\[\033[1;31m\]X'
fi
echo -n '\[\033[1;31m\]'
}
# Prompt
PS1="\[\033[1;31m\]>> \[\033[01;37m\](\[\033[0;37m\]\u@\[\033[0;32m\]\h\[\033[01;37m\]) \[\033[01;34m\]\w\[\033[00m\]\n\[\033[1;31m\]>>\[\033[0;37m\] "
PS1="\[\033[1;31m\]>> \[\033[01;37m\](\[\033[0;37m\]\u@\[\033[0;32m\]\h\[\033[01;37m\]) \[\033[01;34m\]\w\[\033[00m\]\n\[\033[1;31m\]$(prompt_status)>\[\033[0;37m\] "
# If this is an xterm set the title to user@host:dir
case "$TERM" in
@ -119,7 +127,7 @@ if [ -e /usr/local/share/git-core/contrib/completion/git-prompt.sh ] || [ -e /us
export GIT_PS1_SHOWUNTRACKEDFILES=1
export GIT_PS1_SHOWUPSTREAM="auto"
export GIT_PS1_SHOWCOLORHINTS=1
export PROMPT_COMMAND='__git_ps1 "\[\033[1;31m\]>> \[\033[01;37m\](\[\033[0;37m\]\u@\[\033[0;32m\]\h\[\033[01;37m\]) \[\033[01;34m\]\w\[\033[00m\]" "\n\[\033[1;31m\]>>\[\033[0;37m\] "'
export PROMPT_COMMAND='__git_ps1 "\[\033[1;31m\]>> \[\033[01;37m\](\[\033[0;37m\]\u@\[\033[0;32m\]\h\[\033[01;37m\]) \[\033[01;34m\]\w\[\033[00m\]" "\n\[\033[1;31m\]$(prompt_status)>\[\033[0;37m\] "'
fi
# Tmux + ssh agent forwarding