On Mon, 26 Nov 2001, Derek D. Martin wrote:

<snip>

> I will point out that, as with virtually all things, It Depends(tm).
> For the average user, being root all the time is an extremely bad
> idea.  But I'm a system administrator...  the vast majority of what I
> do NEEDS to be done as root.  So I am root most of the time...  Of
> course I don't log in as root, and I maintain seperate xterms (which
> are different colors usually) in different desktops for being root, so
> that it's hard to mistake being root for being a regular user...
>
> Blanket statements are always wrong...  ;-)

Along these lines, I have the following in /etc/bashrc to colorize my
prompts, and ensure that if I am root, either as a login or via an su, my
prompt becomes a distinctive white on red:


if [ $SHLVL = "1" ] ; then
COLOUR=44  # blue
else
COLOUR=45  # magenta
fi

if [ $UID = "0" ] ; then
COLOUR=41  # red
fi

ESC="\033"
STYLE=';1m'  # bold
#STYLE='m'    # plain
export PS1="\[$ESC[$COLOUR;37$STYLE\]\u@\h:\[$ESC[m\]\w\\$ "
export PS2="> "

This also colorizes the prompt in login shells (other than root's) to
white on blue, and in all subsidiary shells (other than root's) to white
on magenta. Handy to know when one more Ctrl-D will log you out. :)

-- 

Bill Mullen
[EMAIL PROTECTED]
Nov 26, 2001


*****************************************************************
To unsubscribe from this list, send mail to [EMAIL PROTECTED]
with the text 'unsubscribe gnhlug' in the message body.
*****************************************************************

Reply via email to