Hmm.  on 'echo $USERNAME' I get root if I've logged in as root, even
while logged in as someone else with 'su', but nothing if I've logged in
as anyone else, unless I've done a 'su root' in which case I get 'root. 
With 'echo $LOGNAME' I get the user currently logged in as, for example,
bob if I've typed 'su bob'.

I'd like it to catch any case of me being 'root', so I think I'm going
to stick with $USERNAME, perhaps later adding in a message to 'root'
somehow about such & such a user (determined by $LOGNAME) shutting down
as 'root'.

        - Theo

Matt Stegman wrote:
> 
> > How about creating a quick script '/etc/threefingersalute', like the one
> > below:
> > - -
> > if [ $USERNAME = "ROOT" ]; then
> 
> I'd suggest you use $LOGNAME instead of $USERNAME.  On my system, `echo
> $USERNAME` returns nothing.  `echo $LOGNAME` on the other hand, returns
> the username of whoever's logged in.  It works just fine with `su` too.
> Also, "root" should be lowercase.
> 
> >  halt
> > else
> >  logout
> > fi
> 
> Other than that, it looks good.
> 
>      -Matt

Reply via email to