turn off bash colored prompts for all users

David dgboles at gmail.com
Sat Aug 3 01:19:41 UTC 2013


On 8/2/2013 8:07 PM, Joe Zeff wrote:
> On 08/02/2013 05:00 PM, David wrote:
>> Well good then. You changed your system from the distroution defaults to
>> what you, personally, want. What works for you.
>>
>> Windows users do that. they set the default installed system to what
>> they want. MacOS users do that too. So all is good then?
> 
> I'd probably prefer it if the various alias scripts were called from
> ~/.bashrc with comments so that they could be commented out, but I'm not
> holding my breath.  As it is, I'm content with what I have, and it's
> easy to show others how to do it if they ask.  I'm not sure why color is
> the default, and I'd be astonished if anybody here knew, but I'm not
> about to waste time arguing the question because it's not important.


I have had this for 'my' prompt(s) for so long, probably around Red Hat 6.0.



COLOR1="\[\033[1;37m\]"

    [ "$PS1" = "\\s-\\v\\\$ " ] && PS1="$COLOR1[\u] \w \\$ "




this makes my prompt show my name in bright white in [] as well as the
current directory


I use this one for 'root'



# Root prompt

COLOR1="\[\033[1;37m\]"
COLOR2="\[\033[1;31m\]"

PS1="$COLOR1[$COLOR2\u$COLOR1] \$PWD \\$ "



which shows 'root' in bright red but the rest in bright white.

These define the variables COLORx and use them in the prompt Something I
learned many, many years ago.

No magic involved. ANSI codes and defining Bash variables. Which is what
I assume they Fedora people, and others, do.

Have a good day.




-- 

  David


More information about the users mailing list