From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5265 invoked from network); 8 Mar 1999 16:11:52 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 8 Mar 1999 16:11:52 -0000 Received: (qmail 2015 invoked by alias); 8 Mar 1999 16:11:23 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 5686 Received: (qmail 2008 invoked from network); 8 Mar 1999 16:11:22 -0000 Message-Id: <9903081555.AA18627@ibmth.df.unipi.it> To: zsh-workers@sunsite.auc.dk (Zsh hackers list) Subject: Re: PATCH: small parameter fix In-Reply-To: "Bart Schaefer"'s message of "Mon, 08 Mar 1999 01:01:01 NFT." <14051.37325.463850.598816@localhost.localdomain> Date: Mon, 08 Mar 1999 16:55:08 +0100 From: Peter Stephenson > > > > ${${...}[...]} > > > > previously didn't really work: if the inner ${...} produced an array > > with only one element, the outer ${...} treated it as a string and the > > subscript gave the n'th character. > > AHA! This must be the reason that "${${(@)...}...}" is required in so > many mystifying circumstances. I, too, would like to hear whether the > previous behavior was intentional ... this change does potentially > break scripts, including I think 3.0.5 scripts, so we'd better tread > carefully. in particular it has this effect: % print "${$(uname -n)[1]}" ibmth where you might guess $(...) in quotes produced a scalar for subscripting --- indeed it did, but the subscripting decided to treat it as an array element. In fact, since the nested substitution recognises the quotes whereas the subscripting doesn't, you get, % print "${${path}[1]}" /home/user2/pws/bin /home/user2/pws/links /home/user2/pws/mh/bin /home/user2/pws/scripts /usr/local/bin /usr/sue/bin /usr/bin /usr/bin/X11 /usr/ucb /usr/local/bin/X11 /cern/pro/bin /usr/local/cap /etc . (wrapped a bit --- well, you don't get that, but I do) which is distinctly on the strange side. I would suggest that in quotes the old behaviour character-subscripting behaviour is the right one. -- Peter Stephenson Tel: +39 050 844536 WWW: http://www.ifh.de/~pws/ Dipartimento di Fisica, Via Buonarroti 2, 56127 Pisa, Italy