Package: bash
Version: 5.1-3
Severity: wishlist

Hey.

/etc/skel/.bashrc uses:
case "$TERM" in
    xterm-color|*-256color) color_prompt=yes;;
esac

to detect whether the terminal supports a colourised prompt or not.


1) Could you please add "linux" to the list. That seems to be what the
kernel console uses, and I guess this always supports colours?
(Haven't checked though, whether there are any kernel parameters or
config options that would allow to disable colour support).


2) Additionally or alternatively one could add a more generic way of
detection.

Perhaps something like:
if [ -x /usr/bin/tput ]; then
        colour_support="$(tput colors 2> /dev/null)"
        if [ $? -eq 0  -a  "${colour_support}" -gt 2 ]; then
                color_prompt=yes
        fi
        unset colour_support
fi

This could be made as the fallback for the current case construct, which
could still list the TERM values known to have colours, e.g. like:
case "$TERM" in
    xterm-color|*-256color) color_prompt=yes;;
    *)
    [the above]
esac


Cheers,
Chris.

Reply via email to