From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4149 invoked from network); 17 Jan 2009 03:35:51 -0000 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.5 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.2.5 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 17 Jan 2009 03:35:51 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 89921 invoked from network); 17 Jan 2009 03:35:44 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 17 Jan 2009 03:35:44 -0000 Received: (qmail 23863 invoked by alias); 17 Jan 2009 03:35:40 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 26330 Received: (qmail 23850 invoked from network); 17 Jan 2009 03:35:40 -0000 Received: from bifrost.dotsrc.org (130.225.254.106) by sunsite.dk with SMTP; 17 Jan 2009 03:35:40 -0000 Received: from vms042pub.verizon.net (vms042pub.verizon.net [206.46.252.42]) by bifrost.dotsrc.org (Postfix) with ESMTP id DFF7F80271F0 for ; Sat, 17 Jan 2009 04:35:36 +0100 (CET) Received: from torch.brasslantern.com ([96.238.220.215]) by vms042.mailsrvcs.net (Sun Java System Messaging Server 6.2-6.01 (built Apr 3 2006)) with ESMTPA id <0KDL001J1JBAF4Q1@vms042.mailsrvcs.net> for zsh-workers@sunsite.dk; Fri, 16 Jan 2009 21:35:35 -0600 (CST) Received: from torch.brasslantern.com (localhost.localdomain [127.0.0.1]) by torch.brasslantern.com (8.13.1/8.13.1) with ESMTP id n0H3ZSMa022431 for ; Fri, 16 Jan 2009 19:35:34 -0800 Received: (from schaefer@localhost) by torch.brasslantern.com (8.13.1/8.13.1/Submit) id n0H3ZR7f022430 for zsh-workers@sunsite.dk; Fri, 16 Jan 2009 19:35:27 -0800 Date: Fri, 16 Jan 2009 19:35:27 -0800 From: Bart Schaefer Subject: Re: treatment of empty strings - why is this not a bug? In-reply-to: To: zsh-workers@sunsite.dk Message-id: <090116193527.ZM22429@torch.brasslantern.com> MIME-version: 1.0 X-Mailer: OpenZMail Classic (0.9.2 24April2005) Content-type: text/plain; charset=us-ascii References: <18796.17298.94642.461735@gargle.gargle.HOWL> <090115201912.ZM20275@torch.brasslantern.com> Comments: In reply to Greg Klanderman "Re: treatment of empty strings - why is this not a bug?" (Jan 16, 12:35pm) X-Virus-Scanned: ClamAV 0.92.1/8872/Fri Jan 16 17:55:46 2009 on bifrost X-Virus-Status: Clean On Jan 16, 12:35pm, Greg Klanderman wrote: } } I don't understand how empty strings get into arrays unless one } explicitly puts them there.. Consider an array populated by using a glob pattern, which is then subjected to replacement using $arr:s/pat// or $arr:h or $arr:t. You don't know at time of execution what will be matched in by the glob, nor necessarily what will be left behind after substitution. If the substitution results in an emtpy string, how often do you want that to remain in the argument list of whatever action you next apply to the contents of the array? If what you're attempting to do is transform one set of file names into another, which is the most common operation at the shell command line if not in scripts, I'd argue that generally you do not. On the other hand, if the file name contains spaces, you don't want it to be split.