Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: File locking within zsh?
- X-seq: zsh-users 10235
- From: Lloyd Zusman <ljz@xxxxxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: Re: File locking within zsh?
- Date: Wed, 10 May 2006 06:02:10 -0400
- Cancel-lock: sha1:bRwk9/JABvGwBX91+OO5UFIbDH0=
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <87r7324zyh.fsf@xxxxxxxxxx> <ltd5emv9lh.fsf@xxxxxxxxxxxxxxxxxx> <009101c673f7$06b3f090$6500000a@venti>
- Sender: news <news@xxxxxxxxxxxxx>
"Brian K. White" <brian@xxxxxxxxx> writes:
> From: "Tim Writer" <tim@xxxxxxxxxxx>
>
>> [ ... ]
>>
>> while ! ln file file.lock 2>/dev/null
>> do
>> sleep 1
>> done
>> # Lock obtained
>>
>> print foo bar baz >>file
>> # do a whole lot of other stuff to "file"
>>
>> rm -f file.lock
>> # Lock released
>>
>> Wrapping this idiom into lock/unlock functions is left as an exercise
>> for the
>> reader. :-)
>
>
> Is that better or worse, and why, than umask 222 ; >file ?
>
> http://www.unix.org.ua/orelly/unix/upt/ch45_36.htm
Thanks to both of you (Brian K. White and Tim Writer). I personally
like the umask version better, because I think I can implement a
variation of it without spawning any extra processes (my goal), given
that umask is an internal zsh command.
--
Lloyd Zusman
ljz@xxxxxxxxxx
God bless you.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author