No color prompt in color capable terminal

Bug #156195 reported by Victor Engmark
4
Affects Status Importance Assigned to Milestone
bash (Ubuntu)
Triaged
Wishlist
Unassigned

Bug Description

The default .bashrc doesn't enable the color prompt, even though `ls --color=yes` shows colors. The following code is in the default .bashrc:
case "$TERM" in
xterm-color)
    PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
    ;;
*)
    PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
    ;;
esac

I propose to change this to the following:
if [ $COLORTERM -o "$TERM" == 'xterm-color' ]; then
    PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
else
    PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
fi

Revision history for this message
Matthias Klose (doko) wrote :

hmm, maybe a matter of taste; I don't like colored prompts ;-)

Changed in bash:
importance: Undecided → Wishlist
status: New → Triaged
Revision history for this message
era (era) wrote :

Mathias, the proposal is not primarily to force color on those who don't want it, but basically to make the code run as the original coder intended. Specifically, it will look at the COLORTERM variable as well as TERM, which will make it work in gnome-terminal. See also bug 103929. I imagine (and hope!) that there is a way to disable COLORTERM if you don't want color prompts. In any event, I believe this is a proposal for the skel bashrc, which power users routinely override anyway.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.