RFC: root/non-root bash prompts different colours?

Nick Bargnesi nbargnesi at gmail.com
Wed Dec 8 18:25:28 UTC 2004


On Wed, 08 Dec 2004 13:09:09 -0500, Frank Pineau <frank at pineaus.com> wrote:
> On Wed, 2004-12-08 at 14:00 -0400, Ben Steeves wrote:
> 
> 
> > On Wed, 8 Dec 2004 12:53:15 -0500, Nick Bargnesi <nbargnesi at gmail.com> wrote:
> > > -- WARNING - LOGGED IN AS ROOT --
> > > [root at machine root]#
> > >
> > > Might look obtrusive but it gets the point across to the color blind
> > > administrators and feature-less terminals.
> >
> > Reverse video is supported on just about every terminal I can think of
> > (I'm sure there are some that I can't, tho :-) -- and it works for
> > colour-blind users, too.
> >
> > Personally, all my root prompts are reversed video, with the
> > background colour different on different servers.  It helps when you
> > have root shells on four or five boxes open at once... wouldn't want
> > to shutdown the wrong server, now would we ;-)
> 
> 
> That was my prompt that Rahul posted.  Sorry about squeaking in mid-
> thread, I just joined the list.
> 
> Yeah, it's an ugly prompt, but it works well for me :)  I used to use
> all-red for root and all white for non-root, but I ran into some issues
> on some terminals I was using.
> 
> It seems to me that if a user were colour blind, then it would be the
> same net effect as not changing the prompt at all.  The prompt already
> contains the user name, as well as a # or a $ (depending on state).
> 
> I don't like the idea of adding "-- WARNING - LOGGED IN AS ROOT --"
> unless it's part of the actual prompt (which would be nuts).  When I've
> got six terminal sessions running and half are root, I need more
> indication besides a one-line banner when I first start the session.
> 

Who said it was a one-liner?  
i.e., 
export PS1="\n-- WARNING - Use your head.  You're root. --\n[\u@\h \W]$ "


> --
> Fix it! Fix it! Fix it! Fix it! Fix it! Fix it!... Fix it! Fix it! Fix
> it!
> 
> --Fry
>   Futurama - "A Clone of My Own"
> 
> 
> --
> fedora-devel-list mailing list
> fedora-devel-list at redhat.com
> http://www.redhat.com/mailman/listinfo/fedora-devel-list
> 
> 
> 


-- 

Nick Bargnesi
http://www.den-4.com
Den 4 Software

pub  1024D/E8BD2FD0 2004-12-02 Nick Bargnesi <nbargnesi at gmail.com>
Key fingerprint = 6F9D 9404 63CD 2B04 DE7A  0F9D A1ED C1B0 E8BD 2FD0
sub  2048g/56C5D45B 2004-12-02




More information about the devel mailing list