From: Robert Dober Date: 2007-07-04T00:52:20+09:00 Subject: Re: mac addr determination On 7/3/07, ara.t.howard wrote: > > thanks! > > -a > -- Nope on Linux def mac_address return @mac_address if defined? @mac_address re = %r<(?:hwaddr|:)\s+((?:[0-9a-f]{1,2}[-:]){5}[0-9a-f]{1,2})\s*$>i lines = begin IO.popen('ifconfig'){|fd| fd.readlines} rescue IO.popen('ipconfig /all'){|fd| fd.readlines} end candidates = lines.map{|l| re.match( l )[1] rescue nil }.compact @mac_address = candidates.first end but not tested on Windows HTH Robert -- I always knew that one day Smalltalk would replace Java. I just didn't know it would be called Ruby -- Kent Beck