From: Philipp Kern Date: 2004-05-31T19:53:37+09:00 Subject: Re: elegant way to say "try this thing, one at a time, until condition is met" On 2004-05-31, Dmitry V. Sabanin wrote: > $counter = 0 > def cond_met > $counter += 1 > $counter > 1 ? true : false > end > > # algo itself, services could be an array of commands to execute > services = %w| httpd squid sendmail |.reverse > begin > serv = services.pop > system "echo /etc/init.d/#{serv} stop" > end until cond_met What's the sense in stopping only two services listed in an array which has more elements than the two? Bye, phil -- Please send replys (not followups) to the address set in Reply-To. Philipp Kern - PK2186-RIPE - http://www.philkern.de