Test for root.
Carl Parrish
plug-discuss@lists.PLUG.phoenix.az.us
Thu, 06 Sep 2001 19:04:39 -0700
Aggggghhhhhh!!!! Thanks guys I've been using this test in several of my
scripts and couldn't figure out why it wasn't working this time. I typed
the wrong ' after whoami but typed it correct in my letter to the list.
Didn't even notice all the time I was looking at my code. And Kevin
thanks I think I'll be checking $UID = 0 from now on.
Carl P.
Kevin Buettner wrote:
>On Sep 6, 5:07pm, Carl Parrish wrote:
>
>>Okay I'm writting a script that tests for root status. like so
>>
>>test `whoami` = 'root' || echo "You must be root to execute the commands."
>>
>>it never seems to be able to pass the test. From the command line I can run whoami and get back root but it never works in the script.
>>Any idea what I'm doing wrong?
>>
>
>I don't think you're doing anything wrong; it works for me...
>
>However, even if you do get the above working, you might want to
>instead consider checking against either $UID or $EUID...
>
>Kevin
>________________________________________________
>See http://PLUG.phoenix.az.us/navigator-mail.shtml if your mail doesn't post to the list quickly and you use Netscape to write mail.
>
>PLUG-discuss mailing list - PLUG-discuss@lists.PLUG.phoenix.az.us
>http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss
>