From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14038 invoked by alias); 14 Sep 2011 21:05:47 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 16354 Received: (qmail 12815 invoked from network); 14 Sep 2011 21:05:45 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 Received-SPF: neutral (ns1.primenet.com.au: 74.125.82.43 is neither permitted nor denied by SPF record at ntlworld.com) X-ProxyUser-IP: 81.97.71.129 Message-Id: <201109142105.p8EL5ZNf008882@pws-pc.ntlworld.com> From: Peter Stephenson To: zsh-users@zsh.org Subject: Re: {fd}< and compound commands In-Reply-To: Message from Stephane Chazelas of "Wed, 14 Sep 2011 20:31:41 BST." <20110914193141.GB7325@yahoo.fr> Date: Wed, 14 Sep 2011 22:05:35 +0100 Stephane Chazelas wrote: > 2011-09-14 20:06:01 +0100, Peter Stephenson: > [...] > > { > > exec {fd} > > > while read; do > > ... > > done <&$fd > > } always { > > exec {fd}<&- > > } > > Thanks Peter, > > Why the "always" here? That's extended { ... } syntax to ensure the clean-up gets executed even if there's an error in the main block. In fact, if I'd known Ruby when I wrote it, I'd probably have called it "ensure" instead. -- Peter Stephenson Web page now at http://homepage.ntlworld.com/p.w.stephenson/