check also the value $USER
it should give root for root
or try this which is tricky
username=`who am i | awk '{print $1'}`
now $username holds the logged in user name
juts copy the line above as it is don't forget the ` this tills linux to
execute what is inside
-----Original Message-----
From: Paul [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, October 23, 2001 11:42 PM
To: [EMAIL PROTECTED]
Subject: Re: [newbie] How can I determine if I'm root in a script
In reply to Mark Johnson's words, written Tue, 23 Oct 2001 10:18:02 -0500
Check the value of $UID. It should be 0 for root.
Paul
>I'm trying to write a bash script to install some files but it must be run
>as root. Is there a way that I can get my script to check to see if it has
>root priviledges and if not exit out?
>
>
--
A mistake is evidence that someone tried to do something.
http://nlpagan.net - Registered Linux User 174403
Linux Mandrake 8.0 - Sylpheed 0.6.3 claws
Open Source, Open Minds. Linux.
Want to buy your Pack or Services from MandrakeSoft?
Go to http://www.mandrakestore.com