From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25130 invoked from network); 10 May 2006 10:05:32 -0000 X-Spam-Checker-Version: SpamAssassin 3.1.1 (2006-03-10) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.5 required=5.0 tests=AWL,BAYES_00, FORGED_RCVD_HELO autolearn=ham version=3.1.1 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 10 May 2006 10:05:32 -0000 Received: (qmail 1802 invoked from network); 10 May 2006 10:05:26 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 10 May 2006 10:05:26 -0000 Received: (qmail 23559 invoked by alias); 10 May 2006 10:05:19 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 10234 Received: (qmail 23548 invoked from network); 10 May 2006 10:05:18 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 10 May 2006 10:05:18 -0000 Received: (qmail 657 invoked from network); 10 May 2006 10:05:18 -0000 Received: from main.gmane.org (HELO ciao.gmane.org) (80.91.229.2) by a.mx.sunsite.dk with SMTP; 10 May 2006 10:05:17 -0000 Received: from list by ciao.gmane.org with local (Exim 4.43) id 1FdlZ6-0000wF-DW for zsh-users@sunsite.dk; Wed, 10 May 2006 12:05:08 +0200 Received: from hippo.e-hippo.net ([216.182.10.250]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 10 May 2006 12:05:08 +0200 Received: from ljz by hippo.e-hippo.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 10 May 2006 12:05:08 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: zsh-users@sunsite.dk From: Lloyd Zusman Subject: Re: File locking within zsh? Date: Wed, 10 May 2006 06:02:16 -0400 Message-ID: <87y7xai4ev.fsf@asfast.com> References: <87r7324zyh.fsf@asfast.com> <20060510062930.GB4340@DervishD> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: hippo.e-hippo.net User-Agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.4 (gnu/linux) Cancel-Lock: sha1:Gb57YTJR7ohojN3ZBxyaw3aY5Pg= Sender: news DervishD writes: > Hi Lloyd :) ”Hola Raśl! > * Lloyd Zusman dixit: >> >> [ ... ] >> >> I know that I can do this with a number of compiled executables, but I'm >> looking for a zsh-only solution. > > Apart from the 'ln' trick, you can do this in Perl if you don't > want compiled executables. Well, the perl interpreter is a compiled executable, and a rather heavy one, at that. I'm trying to avoid spawning any extra processes. > [ ... ] > > If you could ellaborate on the problem you're trying to solve, I > can try to give a better solution. I'm writing a zsh shell function that might be invoked within concurrent terminal sessions. There's a critical section of code within this shell function that I want to protect with an exclusive lock. I only need to protect this critical section from other invocations of this same shell function. I know that there are various file locking executables, and I can also write my own. Plus, I know that I can get this functionality via scripts in perl, ruby, python, etc. I've just been wondering if there's a way to do this solely within zsh, without any ancillary executables being spawned. Perhaps I can write a loadable zsh module which can supply this capability. > Good luck :) Muchas gracias. :) -- Lloyd Zusman ljz@asfast.com God bless you.