From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14532 invoked from network); 19 Feb 2004 17:17:29 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 19 Feb 2004 17:17:29 -0000 Received: (qmail 3748 invoked by alias); 19 Feb 2004 17:16:48 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 7064 Received: (qmail 3692 invoked from network); 19 Feb 2004 17:16:46 -0000 Received: from localhost (HELO sunsite.dk) (127.0.0.1) by localhost with SMTP; 19 Feb 2004 17:16:46 -0000 X-MessageWall-Score: 0 (sunsite.dk) Received: from [4.11.9.147] by sunsite.dk (MessageWall 1.0.8) with SMTP; 19 Feb 2004 17:16:46 -0000 Received: (from schaefer@localhost) by candle.brasslantern.com (8.11.6/8.11.6) id i1JHGi414256 for zsh-users@sunsite.dk; Thu, 19 Feb 2004 09:16:44 -0800 X-Authentication-Warning: candle.brasslantern.com: schaefer set sender to schaefer@closedmail.com using -f From: Bart Schaefer Message-Id: <1040219171644.ZM14255@candle.brasslantern.com> Date: Thu, 19 Feb 2004 17:16:44 +0000 In-Reply-To: <20040219164631.GB2804@DervishD> Comments: In reply to DervishD "Can this be done with an array parameter?" (Feb 19, 5:46pm) References: <20040219164631.GB2804@DervishD> X-Mailer: Z-Mail (5.0.0 30July97) To: Zsh Users Subject: Re: Can this be done with an array parameter? MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii On Feb 19, 5:46pm, DervishD wrote: } } cat filename | while read line } do } info=($info $line) } done } } This effectively store every line as a separate item in the array } parameter, which surprises me. [...] } } Zsh is reading my mind or so. Can anybody explain? I note that PWS didn't bother to explain. :-) Unless the SH_WORD_SPLIT option is set, variable references like $info and $line aren't exactly quoted, but they aren't split up at spaces either. $info is an array, so it acts (almost) like "${info[@]}", but $line is a scalar, so it acts (almost) like "$line". The "almost" part has to do with what happens to array elements or variables whose value is the empty string, and unset variables. They disappear entirely from the expanded command line rather than remaining there as a quoted empty string.