Re: `whoami`? I think I know, my house is in the meadows though...

From: Moshe Jacobson (bramoshe_at_runslinux.net)
Date: 05/17/05


Date: 16 May 2005 18:35:06 -0400

DaLoverhino <DaLoveRhino@hotmail.com> wrote:
> I have a script that needs to get the username. It's not for security
> purposes, but it is used for a simple sanity check.

> This script needs to work on all flavors of unix and unix shells. I
> want to use whoami, but I am worried that it may not be found on all
> flavors of unix+shells? Is this true? If whoami is not universally
> present in all unix flavors, what command would be?

If your script is in bash, you can use the bash variable $USER.

Moshe

-- 
*** SPAM BLOCK: Remove bra before replying! ***
http://runslinux.net :: moshe at runslinux dot net :: AIM: Jehsom


Relevant Pages

  • Re: `whoami`? I think I know, my house is in the meadows though...
    ... > purposes, but it is used for a simple sanity check. ... If whoami is not universally ... > present in all unix flavors, ... "Sharon was a killer obsessed with hatred of Palestinians. ...
    (comp.unix.shell)
  • Re: `whoami`? I think I know, my house is in the meadows though...
    ... >> purposes, but it is used for a simple sanity check. ... >> This script needs to work on all flavors of unix and unix shells. ... >> present in all unix flavors, ...
    (comp.unix.shell)
  • repair script
    ... this script, very slow analysing ... % index of row and colomn informatioan ... % create joint load ekuivalen matrix AE ...
    (comp.soft-sys.matlab)
  • Re: WScript.Sleep for HTA?
    ... >>> which is fine for my purposes! ... > Here's a test script; ... > Dim objWSS ... Dropping the final True seems to give a shorter delay. ...
    (microsoft.public.scripting.vbscript)
  • Re: whoami and bash
    ... Francois wrote: ... I would to be able to cancel a script I've written if I run it as root. ... I know there is a command "whoami" to know who is running the script, but first, I would like the script: ...
    (Fedora)