"tput setaf" is the appropriate check to use, and was already present in
my initial recommendation (via the first comment to this report), and in
fact is what's currently being used (at least in Lucid) in
/etc/skel/.bashrc (if force_color_prompt is set).

There's no way to do an echo/check stdout test as you suggest. It's the
terminal itself that prevents the garbling, and there's no portable way
to check whether a final output string was garbled or not, since there's
no portable way to inspect the display contents on a terminal (AFAIK,
for most terminals there's not even an unportable way).

Note that the difference between "xterm" and "xterm-color" has never
been the difference between color support and no color support; it was
intended to convey the difference between basic color support and
extended (256) color support. That's why I thought it was silly to check
for "xterm-color", but then only make use of basic colors that would
work on "xterm" (no "-color") anyway. We still do that if
force_color_prompt isn't set, and I still think it's silly (but then, I
also think it's silly that gnome-terminal doesn't set TERM to xterm-
color, since gnome-terminal does in fact support extended colors).

-- 
Bash prompt string looks for xterm-color, gnome terminal identifies as xterm
https://bugs.launchpad.net/bugs/103929
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.

-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to