Asp Forum
Home
|
Login
|
Register
|
Search
Forums
>
comp.lang.ruby
how do I find the name of the current user?
Sam Roberts
4/3/2005 2:02:00 AM
I'm thinking Etc.getlogin followed by Etc.getpwnam.gecos might be best
on unix, is there a windowsy equivalent?
Thanks,
Sam
4 Answers
Csaba Henk
4/3/2005 2:48:00 AM
0
On 2005-04-03, Sam Roberts <sroberts@uniserve.com> wrote:
> I'm thinking Etc.getlogin followed by Etc.getpwnam.gecos might be best
> on unix, is there a windowsy equivalent?
Would this help you?
http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-t...
Csaba
Sam Roberts
4/3/2005 3:09:00 AM
0
Quoting csaba@phony_for_avoiding_spam.org, on Sun, Apr 03, 2005 at 11:54:43AM +0900:
> On 2005-04-03, Sam Roberts <sroberts@uniserve.com> wrote:
> > I'm thinking Etc.getlogin followed by Etc.getpwnam.gecos might be best
> > on unix, is there a windowsy equivalent?
>
> Would this help you?
>
http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-t...
It looks great, but I don't want to use it until its in the stdlib. Its
a little more than I want to get the name of the current user.
But, I'll remember, I might need it in the future.
Thanks
Sam
Charles Mills
4/3/2005 5:29:00 AM
0
Sam Roberts wrote:
> Quoting csaba@phony_for_avoiding_spam.org, on Sun, Apr 03, 2005 at
11:54:43AM +0900:
> > On 2005-04-03, Sam Roberts <sroberts@uniserve.com> wrote:
> > > I'm thinking Etc.getlogin followed by Etc.getpwnam.gecos might be
best
> > > on unix, is there a windowsy equivalent?
> >
> > Would this help you?
> >
http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-t...
>
> It looks great, but I don't want to use it until its in the stdlib.
Its
> a little more than I want to get the name of the current user.
>
> But, I'll remember, I might need it in the future.
>
I don't know how portable this is, but:
irb(main):001:0> ENV["USER"]
=> "cmills"
-Charlie
Alan Chen
4/3/2005 5:29:00 AM
0
On Win XP and 2000 I think you can depend on ENV['USERNAME'], on older
windows versions I'm not sure...
- alan
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
how do I find the name of the current user?
Inserendo la tua e-mail nella casella sotto, riceverai un avviso tramite posta elettronica ogni volta che il motore di ricerca troverà un nuovo messaggio per te
Il servizio è completamente GRATUITO!
x
Login to ForumsZone
Login with Google
Login with E-Mail & Password