Yes, flock(1) can do the right job but personally I don't like the way a command is invoked by flock. :)
And flock can only run external commands, it cannot do with things like bash builtins or functions. On Fri, Apr 16, 2010 at 12:04 AM, Eric Blake <ebl...@redhat.com> wrote: > On 04/15/2010 08:28 AM, Clark J. Wang wrote: > > In C code I can use lockf(), flock(), semaphore and mutex for locking / > > unlocking. Can bash provide some similar mechanisms? > > man 1 flock > > If necessary, you may need to install: > ftp://ftp.kernel.org/pub/linux/utils/util-linux-ng/ > > -- > Eric Blake ebl...@redhat.com +1-801-349-2682 > Libvirt virtualization library http://libvirt.org > >