ts <decoux / moulon.inra.fr> wrote in message news:<200204231413.g3NEDbr01417 / moulon.inra.fr>...
> >>>>> "D" == Daniel Berger <djberg96 / hotmail.com> writes:
> 
> D> Is there a 'hostname' command in Ruby (short of backticks, I mean)? 
> 
>  Well, you can do
> 
> pigeon% ruby -rsocket -e 'p Socket.gethostname'
> "pigeon"
> pigeon% 
> 
> 
> Guy Decoux

Oh - just discovered an alternative way as well using 'Resolv.rb',
which I discovered thanks to one of your previous posts Guy. :)

require 'resolv'
h = Resolv::Hosts.new('/etc/hosts')
puts h.getname('172.55.55.55')

Of course, this requires that you know the IP in advance, which isn't
quite what I want (and trying to use 127.0.0.1 only returns
'localhost').  It's also not very portable.

I'm somewhat perplexed as to why this module didn't get a blurb in the
Nutshell book, the Pickaxe, or the Developer's Guide.  Oh, well. :|

Regards,

Dan