On 2/12/07, Michael L Torrie <[EMAIL PROTECTED]> wrote:
> > However, touch works well. Something like this has always worked for me. > > while [ -d /var/somelockfile ]; do sleep 1; done > touch /var/somelockfile > # do something > rm /var/somelockfile Sadly this will not work, at least if you goal is to synchronize multiple scripts running asynchronously. It would have worked in my case, but it's not a semaphore. Who wins when several processes make it past the while loop at about the same time?
Right. This is why you should use the redirect '>' with noclobber instead. With noclobber, the redirect works like an atomic test-and-set. /* PLUG: http://plug.org, #utah on irc.freenode.net Unsubscribe: http://plug.org/mailman/options/plug Don't fear the penguin. */
