Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

alternative to "whoami" ?

146 views
Skip to first unread message

noobuntu

unread,
Jun 30, 2008, 12:14:27 PM6/30/08
to

bash-2.03$ whoami
bash: whoami: command not found


Is there an alternative to "whoami" ?

Dave Uhring

unread,
Jun 30, 2008, 12:48:45 PM6/30/08
to

who am i
/usr/ucb/whoami

noobuntu

unread,
Jun 30, 2008, 12:52:19 PM6/30/08
to

> who am i
> /usr/ucb/whoami

haha never knew "who am i" - thanks

Geoff Lane

unread,
Jun 30, 2008, 12:40:00 PM6/30/08
to

$ who am i


--
1034 gods I don't believe in: http://anya.sighup.org.uk/gods.html

Canuck57

unread,
Jun 30, 2008, 7:35:16 PM6/30/08
to

"noobuntu" <webto...@gmail.com> wrote in message
news:c518e915-63c6-48b2...@y38g2000hsy.googlegroups.com...

>
>> who am i
>> /usr/ucb/whoami
>
> haha never knew "who am i" - thanks

But watch out, they can return different results, an example:

----------
me@trout:/home/me $ su -
Password:
Sun Microsystems Inc. SunOS 5.10 Generic January 2005
root@trout:/root # who am i
me pts/1 Jun 30 17:27 (cod.mydom.net)
root@trout:/root # whoami
root
root@trout:/root #
--------------

'who am i' returns who you logged in as, where as '/usr/ucb/whoami' returns
your effective ID, not always the same either.

It is best to add ucb to your search path:

PATH=$PATH:/usr/ucb:/usr/sfw/bin:/usr/ccs/bin
export PATH

Dave Uhring

unread,
Jun 30, 2008, 8:19:35 PM6/30/08
to
On Mon, 30 Jun 2008 23:35:16 +0000, Canuck57 wrote:

> It is best to add ucb to your search path:

Not! His next question then will be why cc doesn't work.

Worse, if /usr/ucb is not *last* in the $PATH ps will not work as expected
either.

Rich Teer

unread,
Jun 30, 2008, 11:00:58 PM6/30/08
to
On Mon, 30 Jun 2008, noobuntu wrote:

> Is there an alternative to "whoami" ?

Yep:

/usr/xpg4/bin/id -un

rich@zen4153# /usr/xpg4/bin/id -un
rich

--
Rich Teer, SCSA, SCNA, SCSECA

CEO,
My Online Home Inventory

URLs: http://www.rite-group.com/rich
http://www.linkedin.com/in/richteer
http://www.myonlinehomeinventory.com

Rich Teer

unread,
Jun 30, 2008, 11:01:50 PM6/30/08
to
On Mon, 30 Jun 2008, Canuck57 wrote:

> It is best to add ucb to your search path:

Not it is NOT! /usr/ucb is an anacronism, best forgotten in this
day and age.

AGT

unread,
Jul 1, 2008, 12:44:06 AM7/1/08
to
On Mon, 30 Jun 2008 19:19:35 -0500, Dave Uhring wrote:

> On Mon, 30 Jun 2008 23:35:16 +0000, Canuck57 wrote:
>> It is best to add ucb to your search path:
> Not! His next question then will be why cc doesn't work.

: > Good one

> Worse, if /usr/ucb is not *last* in the $PATH ps will not work as expected
> either.

One might try using aliases for /usr/ucb stuff and /usr/xpg? stuff
Keeps PATH clean

Dave Uhring

unread,
Jul 1, 2008, 1:37:30 AM7/1/08
to

Or, if running Nevada or OpenSolaris, just have /usr/gnu/bin in the $PATH.
Heh!, that's not even necessary:

duhring@einstein:~$ which whoami
/usr/bin/whoami

usenetper...@gmail.com

unread,
Jul 1, 2008, 12:03:38 PM7/1/08
to

I havent checked my b90 install for /usr/ucb - hope they dont do away
with it but who knows.
Thing is, a GNU version of something isnt always "better" than the
original.
Is there a vipw for example? Probably not. /usr/ucb/shutdown can get
you
out of some jams that the svr4 descendant cannot. /usr/ucb is small
sans
all the symlinks. I hope it survives the current wave of
"we gotta make Solaris more Lienux friendly" types developing at Sun
nowadays : >

Chris Ridd

unread,
Jul 1, 2008, 12:49:55 PM7/1/08
to
On 2008-07-01 17:03:38 +0100, usenetper...@gmail.com said:

> On Jun 30, 10:37 pm, Dave Uhring <daveuhr...@yahoo.com> wrote:
>> On Mon, 30 Jun 2008 21:44:06 -0700, AGT wrote:
>>> On Mon, 30 Jun 2008 19:19:35 -0500, Dave Uhring wrote:
>>>> Worse, if /usr/ucb is not *last* in the $PATH ps will not work as expec
> ted
>>>> either.
>>> One might try using aliases for /usr/ucb stuff and /usr/xpg? stuff
>>> Keeps PATH clean
>> Or, if running Nevada or OpenSolaris, just have /usr/gnu/bin in the $PATH.
>
>> Heh!, that's not even necessary:
>> duhring@einstein:~$ which whoami
>> /usr/bin/whoami
>
> I havent checked my b90 install for /usr/ucb - hope they dont do away
> with it but who knows.

It is still there in b91, as is /usr/ucblib and /usr/ucbinclude.

Cheers,

Chris

Dave Uhring

unread,
Jul 1, 2008, 1:02:24 PM7/1/08
to
On Tue, 01 Jul 2008 09:03:38 -0700, usenetpersongerryt wrote:

> I havent checked my b90 install for /usr/ucb - hope they dont do away
> with it but who knows.

With Sun's promise of backward compatibility /usr/ucb and cousins will
probably remain for some time to come.

> Thing is, a GNU version of something isnt always "better" than the
> original.

Granted, but sometimes the GNU versions do have additional or different
utility. Additionally, the presence of such penguinware eases the
transition for Linux emigrés.

Chris Ridd

unread,
Jul 1, 2008, 1:28:17 PM7/1/08
to

The -r option in GNU's grep is quite handy, for instance.

Cheers,

Chris

Dave Uhring

unread,
Jul 1, 2008, 2:24:02 PM7/1/08
to
On Tue, 01 Jul 2008 18:28:17 +0100, Chris Ridd wrote:

> The -r option in GNU's grep is quite handy, for instance.

You mean it's easier than find . -type f -exec grep pattern {} + ;>

Thommy M.

unread,
Jul 1, 2008, 3:00:24 PM7/1/08
to

Not to mention -A and -B

0 new messages