From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24099 invoked from network); 11 May 2006 16:39:22 -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; 11 May 2006 16:39:22 -0000 Received: (qmail 79965 invoked from network); 11 May 2006 16:39:16 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 11 May 2006 16:39:16 -0000 Received: (qmail 8625 invoked by alias); 11 May 2006 16:39:08 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 10249 Received: (qmail 8616 invoked from network); 11 May 2006 16:39:08 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 11 May 2006 16:39:08 -0000 Received: (qmail 78874 invoked from network); 11 May 2006 16:39:07 -0000 Received: from vms048pub.verizon.net (206.46.252.48) by a.mx.sunsite.dk with SMTP; 11 May 2006 16:39:07 -0000 Received: from torch.brasslantern.com ([71.116.105.50]) by vms048.mailsrvcs.net (Sun Java System Messaging Server 6.2-4.02 (built Sep 9 2005)) with ESMTPA id <0IZ400M7U0WCSE0G@vms048.mailsrvcs.net> for zsh-users@sunsite.dk; Thu, 11 May 2006 11:38:37 -0500 (CDT) Received: from torch.brasslantern.com (localhost.localdomain [127.0.0.1]) by torch.brasslantern.com (8.13.1/8.13.1) with ESMTP id k4BGcaQo013209 for ; Thu, 11 May 2006 09:38:36 -0700 Received: (from schaefer@localhost) by torch.brasslantern.com (8.13.1/8.13.1/Submit) id k4BGcZCk013208 for zsh-users@sunsite.dk; Thu, 11 May 2006 09:38:35 -0700 Date: Thu, 11 May 2006 09:38:35 -0700 From: Bart Schaefer Subject: Re: Parameter expansion flags question In-reply-to: To: Message-id: <060511093835.ZM13207@torch.brasslantern.com> MIME-version: 1.0 X-Mailer: OpenZMail Classic (0.9.2 24April2005) Content-type: text/plain; charset=us-ascii References: Comments: In reply to "John Cooper" "RE: Parameter expansion flags question" (May 11, 10:59am) [skipping around a bit] On May 11, 10:59am, John Cooper wrote: } } One final thing - when I entered the "read" example into the shell as } stated I got syntax errors. These were resolved by using "do" and "done" } instead of braces - is this to be expected? Yeah, I messed up. I never use the form with the braces, but you did in your original "for" sample, so I tried to keep it with "while". I forgot that for "while" loops it only works when the first condition is [[ ... ]] or (( ... )). } Thanks for the detailed reply - it seems using "read" is the most } straightforward approach. However, in the interests of learning more } about expansions, I've been trying your suggestions and they don't seem } to work as expected. Oh, duh. I spaced that there were multiple lines of output from the $SITEMGR program. Obviously you need to process each line separately before applying the subscript. (This cold I'm coming down with must be affecting me worse than I thought.) } If I add the ":#pattern" operator to the original function, the "for" } loop is still executed once in the case where $SITEMGR produces no } output: } delsites4 () { } for site in "${(f)$($SITEMGR -i):#}" Placement of the quotes is important: for site in ${(f)"$($SITEMGR -i)":#} If it still happens, I think it's because of Cygwin line termination. Instead of an empty string when splitting with (f), you're getting a string having a single carriage-return character.