whoami and bash

Luciano Rocha strange at nsk.no-ip.org
Wed Jul 11 13:12:51 UTC 2007


On Wed, Jul 11, 2007 at 02:37:37PM +0200, Francois wrote:
> > Why do you not use the "id -u" command and check for 0 as result?
> 
> Yes, I could do that. thanks. Francois

If you're checking for root user, you can use also $UID.
if [ $UID -eq 0 ]; then
	echo "I am root"
else
	echo "I am a lowly user with id $UID"
fi

-- 
lfr
0/0
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.fedoraproject.org/pipermail/users/attachments/20070711/c076168b/attachment-0002.bin 


More information about the users mailing list