From: "Dmitry V. Sabanin" Date: 2004-06-01T02:32:45+09:00 Subject: Re: elegant way to say "try this thing, one at a time, until condition is met" On Monday 31 May 2004 18:53, Philipp Kern wrote: > 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? It's just an emulation of how umount /usr will possibly work, probably it will unmount partition before everything is killed. I should be more clear next time > Bye, > phil -- sdmitry -=- Dmitry V. Sabanin MuraveyLabs. Spam Here -> postmaster@sco.com