Subject: Re: bin/32904 (uname, logname, id in /usr/bin should be in /bin)
To: SODA Noriyuki <soda@sra.co.jp>
From: SODA Noriyuki <soda@sra.co.jp>
List: netbsd-bugs
Date: 02/23/2006 00:41:59
>>>>> On Wed, 22 Feb 2006 15:36:44 GMT, i18rabbit@cwazy.co.uk 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...
else
I am random user...
fi
> 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
ostype=`uname`
elif [ -x /sbin/sysctl ]; then
ostype=`sysctl -n kern.ostype`
else
...
in your script.
--
soda