From: Alexander Barton Date: Wed, 21 Jul 2010 13:12:44 +0000 (+0200) Subject: Use colors in default bash prompt (PS1) X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?p=ConfigScripts.git;a=commitdiff_plain;h=8d059548a750ecd8c9e6b63f53c3a8b031969ed1 Use colors in default bash prompt (PS1) --- diff --git a/sys/bashrc b/sys/bashrc index c32791c..8accc37 100644 --- a/sys/bashrc +++ b/sys/bashrc @@ -57,13 +57,20 @@ case "$TERM" in esac # Shell prompt +PS1="${COLOR_PREPOSTTXT}${PS1_BEGIN:-<}" [ "$UID" -eq 0 ] \ - && PS1="\h:\w \\\$ " \ - || PS1="\u@\h:\w \\\$ " -if [ "\$(type -t __git_ps1)" ]; then - PS1="\$(__git_ps1 '(%s) ')$PS1" -fi -PS1="${chroot_name:+[$chroot_name] }$PS1" + || PS1="${PS1}${COLOR_USER}\u${COLOR_AT}@" +PS1="${PS1}${COLOR_HOST}\h" +PS1="${PS1}${COLOR_COLON}:" +PS1="${PS1}${COLOR_PATH}\w" +PS1="${PS1}${COLOR_PREPOSTTXT}${PS1_END:->}${COLOR_RESET} " +[ "$UID" -eq 0 ] \ + && PS1="${PS1}${COLOR_PROMPT_ROOT}\\\$${COLOR_RESET} " \ + || PS1="${PS1}${COLOR_PROMPT_USER}\\\$${COLOR_RESET} " +[ "\$(type -t __git_ps1)" ] \ + && PS1="\$(__git_ps1 '(${COLOR_VCS}%s${COLOR_RESET}) ')${PS1}" +PS1="${chroot_name:+[${COLOR_CHROOT}$chroot_name${COLOR_RESET}] }${PS1}" +PS1="${COLOR_RESET}${PS1}" # Enable bash completion, if available [ -z "$BASH_COMPLETION" -a -r /etc/bash_completion ] \