Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ## Append debian chroot labels to prompt
- if [ -z "$debian_chroot" -a -r /etc/debian_chroot ]; then
- debian_chroot=$(cat /etc/debian_chroot)
- fi
- ## colors
- DEFAULT='0;39m'
- ps1color() {
- local color=$DEFAULT
- # read local colors
- if [ -f "$HOME/.color" ] ; then color=$(cat $HOME/.color) ; fi
- # error message - recolor to red
- if [[ $1 != 0 ]] ; then
- color="0;31m" ;
- fi
- # root - red bgcolor, clobbers all other colors (including error)
- if [ ${UID} -eq 0 ]; then
- color='37;41m'
- fi
- echo $color;
- }
- ## Prompt w/ date, color if root, deb chroot
- MYPROMPT='<\T> \u@\h${debian_chroot:+.$debian_chroot}:\w\$ '
- TITLE=""
- case $TERM in
- xterm*|aterm|screen|rxvt*)
- TITLE="\[\033];\u@\h\007\]"
- ;;
- esac
- PROMPT_COMMAND='COLOR=$(ps1color $?) ; history -a; history -r; PS1="${TITLE}\[\e[$COLOR\]$MYPROMPT\[\e[$DEFAULT\]"'
Advertisement
Add Comment
Please, Sign In to add comment