Does whoami exists in Erlang?

Luke Gorrie <>
Tue Jul 24 14:51:32 CEST 2001


Sean Hinde <> writes:

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

And yet another is

  1> os:getenv("HOME").
  "/home/luke"

Cheers,
Luke




More information about the erlang-questions mailing list