From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24612 invoked from network); 27 Nov 2001 19:22:24 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 27 Nov 2001 19:22:24 -0000 Received: (qmail 360 invoked by alias); 27 Nov 2001 19:21:37 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 4511 Received: (qmail 345 invoked from network); 27 Nov 2001 19:21:36 -0000 Date: Tue, 27 Nov 2001 19:21:34 +0000 To: zsh-users@sunsite.auc.dk Subject: Re: field splitting behavior Message-ID: <20011127192134.I8299@fysh.org> References: <15363.58319.278466.686768@paullew-ultra.cisco.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <15363.58319.278466.686768@paullew-ultra.cisco.com> User-Agent: Mutt/1.3.23i From: Zefram Paul Lew wrote: >> var='foobar' >> echo ${(@)${(s/:/)var}[1]} >f > >So why it did field splitting on each character when there is no >separator ':' found? I would expect 'foobar' on the output. The result of the splitting is a single word "foobar", as you expect. This is then treated as a scalar, not an array, and so the [1] extracts the first character, instead of the first element. The (@) doesn't do what you think it does (it only has an effect where double quotes are used). I don't see any easy way to force the result of a ${(s...)...} to be treated as an array, so I'll have to leave that to the expansion wizards. -zefram