Subject: Re: bin/32904 (uname, logname, id in /usr/bin should be in /bin)
To: SODA Noriyuki <firstname.lastname@example.org>
From: SODA Noriyuki <email@example.com>
Date: 02/23/2006 00:41:59
>>>>> On Wed, 22 Feb 2006 15:36:44 GMT, firstname.lastname@example.org said:
> and they can't determine who you
> are (eg, you can't find out that you are root on a broken
> machine as opposed to a regular user on a working machine).
It's pretty easy to determine whether you are root or not
by the statement below:
if [ -w / ]; then
I am super user...
I am random user...
> forces one to remember OS specific things like
> "/sbin/sysctl -n kern.ostype"
Well, you don't have to remember that, you can use
if [ -x /bin/uname ]; then
elif [ -x /sbin/sysctl ]; then
ostype=`sysctl -n kern.ostype`
in your script.