[clug-talk] file locking in bash?

Mark Carlson carlsonmark at gmail.com
Fri Jul 27 08:45:04 PDT 2007


On 7/27/07, Roy Souther <roy at silicontao.com> wrote:
>
>  I have no man pages for flock.
>
>  Could you give me an example of how to use that in bash?

Sorry, I thought it was a regularly distributed command (silly me...
it is installed on my fedora box, that should have raised some
flags... darn redhat)

http://www.linuxcommand.org/man_pages/flock1.html

It is apparently part of util-linux.  Although, at the very least you
should have a man page for the flock(2) system call... odd...

Some info on util-linux:
http://www.linuxfromscratch.org/lfs/view/6.2/chapter06/util-linux.html

>From the man page link, above:

EXAMPLES (invoking some imaginary programs)

       flock /etc/passwd read-and-write-to-passwd

       flock --shared /etc/passwd just-read-something-from-passwd

       flock --timeout=0 /sys /usr/local/bin/update-hotplug /sys



More information about the clug-talk mailing list