Grant schreef:
>>>The code in my bashrc that seems to correspond with the above code is
>>>a bit different so I tried commenting it out and adding your's.  I
>>>then ran env-update and 'source /etc/profile' but still no colors.
>>>Should I post my bashrc?  Maybe it wasn't updated properly because my
>>>baselayout is hard masked?
>>>
>>>- Grant
>>>
>>
>>But the code you changed wasn't in either /etc/profile or any of the env
>>file that are updated by env-update-- it was in ~/.bashrc.
>>
>>So try . ~/.bashrc (source ~/.bashrc), and see if that helps.
>>
>>Holly
> 
> 
> It actually looks like the only time I don't get console colors is
> when I'm root.  Does that help track this down?
> 
> - Grant
> 

Does root have a ~/.bashrc? If not, then when root logs in (either
normally, or via an 'su -'), it looks like the console characteristics
are set via /etc/bash/bashrc (but I've just upgraded to bash 3, so this
may be a new setup than bash 2.05).

Anyway, I notice that the relevant section of this file reads as follows:

# Set colorful PS1 only on colorful terminals.
# dircolors --print-database uses its own built-in database
# instead of using /etc/DIR_COLORS.  Try to use the external file
# first to take advantage of user additions.
use_color=false
safe_term=${TERM//[^[:alnum:]]/.}       # sanitize TERM

if [[ -f /etc/DIR_COLORS ]] ; then
        grep -q "^TERM ${safe_term}" /etc/DIR_COLORS && use_color=true
elif type -p dircolors >/dev/null ; then
        if dircolors --print-database | grep -q "^TERM ${safe_term}" ; then
                use_color=true
        fi
fi

if ${use_color} ; then
        if [[ ${EUID} == 0 ]] ; then
                PS1='\[\033[01;31m\]\h \[\033[01;34m\]\W \$ \[\033[00m\]'
        else
                PS1='\[\033[01;[EMAIL PROTECTED] \[\033[01;34m\]\w \$ 
\[\033[00m\]'
        fi
else
        if [[ ${EUID} == 0 ]] ; then
                # show root@ when we don't have colors
                PS1='[EMAIL PROTECTED] \W \$ '
        else
                PS1='[EMAIL PROTECTED] \w \$ '
        fi
fi


Notice that the first line of this section is usecolor=false?

Maybe for some reason /etc/DIR_COLORS is not being recognized (which
would then change the setting to use_color=true, or for some other
reason your terminal is not being recognized as able to use color.

Personally, I would just copy my user's ~/.bashrc to /root/bashrc, make
any appropriate changes (I like to distinguish my root colors and prompt
from the user's, but they're otherwise the same, mostly). In fact,
that's what I pretty much did, because iirc, root didn't have a
~/.bashrc originally. Anyway, then I would just . ~/.bashrc from a root
terminal, and get on with my life. I'm sure there's a more elegant way
around this, but my geekishness does not extend to futzing around with
whether there's a DIR_COLORS, figuring out why the root terminal only
won't notice it, and digging through obscure config files to change
what's probably a one-line setting. ~/.bashrc trumps all of them, so I
just use that.

HTH,
Holly
-- 
gentoo-user@gentoo.org mailing list

Reply via email to