From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14310 invoked from network); 9 Mar 1999 08:20:33 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 9 Mar 1999 08:20:33 -0000 Received: (qmail 23162 invoked by alias); 9 Mar 1999 08:19:59 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 5696 Received: (qmail 23155 invoked from network); 9 Mar 1999 08:19:58 -0000 Date: Tue, 9 Mar 1999 09:19:12 +0100 (MET) Message-Id: <199903090819.JAA12538@beta.informatik.hu-berlin.de> From: Sven Wischnowsky To: zsh-workers@sunsite.auc.dk In-reply-to: Peter Stephenson's message of Mon, 08 Mar 1999 16:55:08 +0100 Subject: Re: PATCH: small parameter fix Peter Stephenson wrote: > 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. With the patch below we get: % echo ${$(uname -n)[1]} beta % echo "${$(uname -n)[1]}" b % echo ${${path}[1]} /users/wischnow/bin/alpha % echo "${${path}[1]}" / ...which seems sensible to me. Bye Sven --- os/subst.c Mon Mar 8 09:51:27 1999 +++ Src/subst.c Tue Mar 9 09:16:13 1999 @@ -976,7 +976,8 @@ skipparens(*s, *s == Inpar ? Outpar : Outbrace, &s); sav = *s; *s = 0; - if (multsub(&val, (aspar ? NULL : &aval), &isarr, NULL) && quoted) { + if (multsub(&val, ((quoted || aspar) ? NULL : &aval), &isarr, NULL) && + quoted) { isarr = -1; aval = alloc(sizeof(char *)); aspar = 0; -- Sven Wischnowsky wischnow@informatik.hu-berlin.de