User command

Jay R. Ashworth jra at baylink.com
Wed May 26 10:32:46 PDT 2004


On Fri, Mar 05, 2004 at 08:20:20PM -0500, Fairlight wrote:
> Hmmm...Solaris gives me just 'fairlite' for `whoami`, but `who am i`
> results in the full line with the terminal.  It has dual BSD and SysV
> behaviour.  Ah, because `whoami` is in /usr/ucb/bin, which is the
> repository on SysV systems for BSD programs, whereas the expanded form is
> from /bin/who.
> 
> It's really a SysV vs BSD issue.

I suspect *everyone's* who will return the asking user's name when given
two arguments; my V7 manuals (Holt, Rinehart/Bell Labs, 1977; I was
Unix when Unix wasn't cool...) note that "who are you" will also work,
and I recall some other Unix text noting that "who mom loves" was also
traditional, though *I* note that it's gramatically incorrect (I read
too much Spenser).

whoami(1) is a Berzerkeley specific command; my GNU man page notes that
it's equivalent to id -un, and specific to the current EUID; it
therefore won't help too much for what the original poster wanted.

And no, there's no other decent way to get it either; just add

TTY=`tty; export TTY

to your /etc/profile and be done with it.

Cheers,
-- jra
-- 
Jay R. Ashworth                                                jra at baylink.com
Member of the Technical Staff     Baylink                             RFC 2100
The Suncoast Freenet         The Things I Think
Tampa Bay, Florida        http://baylink.pitas.com             +1 727 647 1274

        "They had engineers in my day, too."  -- Perry Vance Nelson


More information about the Filepro-list mailing list