From: "Dmitry V. Sabanin" Date: 2004-05-31T18:06:52+09:00 Subject: Re: elegant way to say "try this thing, one at a time, until condition is met" On Monday 31 May 2004 16:31, David Garamond wrote: > Example: I need to unmount /usr and /usr2, but currently I can't because > there are some opened files from those partitions. I am going to try > shutting down daemons or killing some processes (or other things), one > at a time, until I can unmount it. Sorry if that's not what you want, but i had this idea when I read your post: # emulating condition $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 -- sdmitry -=- Dmitry V. Sabanin MuraveyLabs. Spam Here -> postmaster@sco.com