From: dblack@... Date: 2005-12-28T02:49:18+09:00 Subject: Re: Found a neat trick for doing recursive one-liners On Wed, 28 Dec 2005, ara.t.howard@noaa.gov wrote: > On Wed, 28 Dec 2005 dblack@wobblini.net wrote: > >> Hi -- >> >> On Wed, 28 Dec 2005, ara.t.howard@noaa.gov wrote: >> >>> On Tue, 27 Dec 2005, Philip Rhoades wrote: >>> >>>>> ruby -e' puts Dir["**/**"].select{|e| e =~ /a.rb/} ' >>>> >>>> >>>> That doesn't seem to do anything . . >>> >>> then you probably don't have any files named 'a.rb' under the current >>> directory - i seem to have several hundred ;-) >> >> Or abrb, or acrb, or airbag, or.... :-) > > indeed. or diectories. that's the nice thing about using select: > > ruby -e' puts Dir["**/**"].select{|e| test ?f, e and e =~ /^a\.rb$/} ' I was just obliquely pointing out the lack of ^ and \. and $ :-) But it's true that Dir.[] is not very seletcive.... In fact, I think I once submitted an RCR to let it take a second argument that would be tested for (like: Dir["**/**"],?f]) but it was rejected. So here I am several years later still acting as if Dir.[] could read my mind.... David -- David A. Black dblack@wobblini.net "Ruby for Rails", from Manning Publications, coming April 2006! http://www.manning.com/books/black