Guest User

valadil's bashrc

a guest
Jul 17th, 2010
318
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.89 KB | None | 0 0
  1. ## Append debian chroot labels to prompt
  2. if [ -z "$debian_chroot" -a -r /etc/debian_chroot ]; then
  3.     debian_chroot=$(cat /etc/debian_chroot)
  4. fi
  5.  
  6. ## colors
  7. DEFAULT='0;39m'
  8. ps1color() {
  9.   local color=$DEFAULT
  10.  
  11.         # read local colors
  12.         if [ -f "$HOME/.color" ] ; then color=$(cat $HOME/.color) ; fi
  13.  
  14. # error message - recolor to red
  15.   if [[ $1 != 0 ]] ; then
  16.           color="0;31m" ;
  17.   fi
  18.  
  19.   # root - red bgcolor, clobbers all other colors (including error)
  20.   if [ ${UID} -eq 0 ]; then
  21.     color='37;41m'
  22.   fi
  23.   echo $color;  
  24. }
  25.  
  26. ## Prompt w/ date, color if root, deb chroot
  27. MYPROMPT='<\T> \u@\h${debian_chroot:+.$debian_chroot}:\w\$ '
  28.  
  29. TITLE=""
  30. case $TERM in
  31.     xterm*|aterm|screen|rxvt*)
  32.         TITLE="\[\033];\u@\h\007\]"
  33.         ;;
  34.     esac
  35.  
  36. PROMPT_COMMAND='COLOR=$(ps1color $?) ; history -a; history -r; PS1="${TITLE}\[\e[$COLOR\]$MYPROMPT\[\e[$DEFAULT\]"'
Advertisement
Add Comment
Please, Sign In to add comment