Comment 27 for bug 103929

Revision history for this message
michael perigard (overprescribed) wrote :

So, here's the $64,000 question; is a colored prompt default in Ubuntu when using a color-capable terminal or not?

I'm just advocating for some consistency here.

It seems odd to see

# set a fancy prompt (non-color, unless we know we "want" color)
case "$TERM" in
    xterm-color) color_prompt=yes;;
esac

followed by

# uncomment for a colored prompt, if the terminal has the capability; turned
# off by default to not distract the user: the focus in a terminal window
# should be on the output of commands, not on the prompt
#force_color_prompt=yes

To me that says 'the default behavior is not to give you a color prompt, unless you're using xterm-color, in which case we're going to give you one, even though the default behavior is never to give you colored prompts in all the other terminals that support color but don't happen to identify themselves as xterm-color.'

If we're going to say that colored prompts are not the default in Ubuntu, then I don't see why the chunk of code coloring xterm-color terminal prompts still exists. It's confusing to me to see a colored prompt when I log in from an OSX machine using iTerm, and then to see the color disappear when I launch a screen. Makes the user (makes me, anyway) feel like they must have done something wrong, because they have a colored prompt sometimes and not other times. Having no colored prompts altogether without changing the force_color_prompt variable seems more consistent. "I had no colored prompts, I changed the variable, all my prompts are colored."

Even though I eventually found the force_color_prompt variable, I don't like making changes to configuration files when I don't understand the rationale behind the code (workarounds = bad ; accepted config changes that will persist throughout updates = good). It also took a little chunk of my morning to figure this all out, and I'm trying to save everyone else the time :)

I also agree with those that think color prompts /should/ be the default in any terminal that supports it, considering power users are more likely to have a preference on color vs no color (and can easily change the variable), and considering I agree that a colored prompt does not distract nor take away from the output of a command, but in fact helps the user locate the beginning of the output of the last command. Having a different color for root vs non-root users (red vs green) would also supplement the $ vs # prompt and helps users be wary when they are logged in as root (though I'm thinking this was the behavior in Gentoo and might not happen in Ubuntu since it discourages root logins altogether).

Here's hoping the very simple block of script setting a colored prompts for xterm-color terminals can be removed. Simple instructions could be added to https://help.ubuntu.com/community/UsingTheTerminal or https://help.ubuntu.com/community/CommandlineHowto instructing users which variable to edit for colorless (or always colored) prompts. As for making people backport their .bashrc from /etc/skel, you're right, users shouldn't need to do this, and changing the /etc/skel/.bashrc won't affect existing users who have already configured colored prompts for themselves or are happy with the current behavior. Removing the xterm-color checking script from the skel/.bashrc would only affect new users on a system, who, if they had used a *NIX before and noticed their xterm-color terminals weren't giving color prompts, could find the instructions on the wiki (or this bug report or the forum or blog posts or other places it's bound to turn up eventually) and make the simple change to their ~/.bashrc or ~/.profile or wherever the variable should be set (I'm not an expert on shells and logins and environment variables).

If a power user is currently sourcing skel/.bashrc from their ~/.bashrc (as someone mentioned above), and we don't make colored prompts the default for all terminals that support them, they will, unfortunately, lose their colored xterm-color prompts, but if they're savvy enough to know how to source skel/.bashrc, they should be able to figure out how to change the force_ variable and restore them.

Lastly, I disagree with this being categorized as a Wishlist item rather than a bug, though I try not to be in the habit of changing such things when I'm not the package maintainer. At this point, the Ubuntu colored prompt implementation is inconsistent for no reason apparent to me, and I'm suggesting the behavior be consistent and make sense to a new-to-Ubuntu user; colored prompts are on *or* colored prompts are off, regardless of what someone decides the default should be.