Does whoami exists in Erlang?

Sean Hinde Sean.Hinde@REDACTED
Tue Jul 24 13:44:04 CEST 2001


> Hi,
> 
> I like to write a configfile into the users-home directory, 
> but therefore
> I need to know the current username. Does in Erlang something 
> like "whoami" exists like in unix?

You can always use:

1>os:cmd("whoami").
"sean/n"
2>

or even:

2>os:cmd("echo $HOME").
"/export/home/sean/n"
3>

which will give you the home directory of the user who started the beam
process (barring no doubt some determined effort by the user to hide this..)

Sean



NOTICE AND DISCLAIMER:
This email (including attachments) is confidential.  If you have received
this email in error please notify the sender immediately and delete this
email from your system without copying or disseminating it or placing any
reliance upon its contents.  We cannot accept liability for any breaches of
confidence arising through use of email.  Any opinions expressed in this
email (including attachments) are those of the author and do not necessarily
reflect our opinions.  We will not accept responsibility for any commitments
made by our employees outside the scope of our business.  We do not warrant
the accuracy or completeness of such information.




More information about the erlang-questions mailing list