alternative to "whoami" ? - Solaris

This is a discussion on alternative to "whoami" ? - Solaris ; bash-2.03$ whoami bash: whoami: command not found Is there an alternative to "whoami" ?...

+ Reply to Thread
Results 1 to 15 of 15

Thread: alternative to "whoami" ?

  1. alternative to "whoami" ?


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


    Is there an alternative to "whoami" ?

  2. Re: alternative to "whoami" ?

    noobuntu wrote:
    >
    > bash-2.03$ whoami
    > bash: whoami: command not found
    >
    >
    > Is there an alternative to "whoami" ?


    $ who am i


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

  3. Re: alternative to "whoami" ?


    > who am i
    > /usr/ucb/whoami


    haha never knew "who am i" - thanks

  4. Re: alternative to "whoami" ?


    "noobuntu" wrote in message
    news:c518e915-63c6-48b2-9182-8e03e8e3a80b@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




  5. Re: alternative to "whoami" ?

    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.


  6. Re: alternative to "whoami" ?

    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

  7. Re: alternative to "whoami" ?

    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.

    --
    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

  8. Re: alternative to "whoami" ?

    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

  9. Re: alternative to "whoami" ?

    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 expected
    >> 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


  10. Re: alternative to "whoami" ?

    On Jun 30, 10:37*pm, Dave Uhring 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 expected
    > >> 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.
    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 : >

  11. Re: alternative to "whoami" ?

    On 2008-07-01 17:03:38 +0100, usenetpersongerryt@gmail.com said:

    > On Jun 30, 10:37*pm, Dave Uhring 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


  12. Re: alternative to "whoami" ?

    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.


  13. Re: alternative to "whoami" ?

    On 2008-07-01 18:02:24 +0100, Dave Uhring said:

    > On Tue, 01 Jul 2008 09:03:38 -0700, usenetpersongerryt wrote:
    >
    >> 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.


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

    Cheers,

    Chris


  14. Re: alternative to "whoami" ?

    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 {} + ;>


  15. Re: alternative to "whoami" ?

    Chris Ridd wrote:
    > On 2008-07-01 18:02:24 +0100, Dave Uhring said:
    >
    >> On Tue, 01 Jul 2008 09:03:38 -0700, usenetpersongerryt wrote:
    >>
    >>> 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.

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


    Not to mention -A and -B

+ Reply to Thread