Getting user login name

As a first trial within ruby, i’d like to make a verys simple
installer/uninstaller (on MacOS X).

For that purpose, i need to get the user login name in order to build a
path.

from command line i get that name by :
% users

yvonthor

how could i get the same within ruby ???

···


Yvon

not sure if this woeks on MacOSX, but I think it should:

On my box:
require ‘etc’
Etc.getlogin #=> “gabriele”

BTW you could always do
username=users
to use the OS command

···

il Sat, 20 Sep 2003 10:37:14 +0200, yvon.thoravallist@-SUPPRIMEZ-free.fr.invalid (Yvon Thoraval) ha scritto::

As a first trial within ruby, i’d like to make a verys simple
installer/uninstaller (on MacOS X).

For that purpose, i need to get the user login name in order to build a
path.

from command line i get that name by :
% users

yvonthor

how could i get the same within ruby ???

On my box:
require ‘etc’
Etc.getlogin #=> “gabriele”

tanxs a lot, this one works fine :slight_smile:

BTW you could always do
username=users
to use the OS command
giving :
irb(main):001:0> username=users
SyntaxError: compile error
(irb):1: parse error
username=
^
from (irb):1

probably the wasn't correct ? i had to type in followed by a space to get it ?

anyway, one solution is enough to me…

···

gabriele renzi surrender_it@remove.yahoo.it wrote:


Yvon