From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2527 invoked from network); 9 Jun 1998 20:15:42 -0000 Received: from math.gatech.edu (list@130.207.146.50) by ns1.primenet.com.au with SMTP; 9 Jun 1998 20:15:42 -0000 Received: (from list@localhost) by math.gatech.edu (8.8.5/8.8.5) id QAA19034; Tue, 9 Jun 1998 16:10:47 -0400 (EDT) Resent-Date: Tue, 9 Jun 1998 16:10:47 -0400 (EDT) From: Zefram Message-Id: <199806092011.VAA05499@taos.demon.co.uk> Subject: Re: ${=variable} doesn't always produce an array -- why? To: schaefer@brasslantern.com (Bart Schaefer) Date: Tue, 9 Jun 1998 21:11:34 +0100 (BST) Cc: zsh-workers@math.gatech.edu In-Reply-To: <980609124159.ZM6845@candle.brasslantern.com> from "Bart Schaefer" at Jun 9, 98 12:41:58 pm X-Mailer: ELM [version 2.4 PL25] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Resent-Message-ID: <"QMoDr.0.Lf4.7RPVr"@math> Resent-From: zsh-workers@math.gatech.edu X-Mailing-List: archive/latest/4070 X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu Bart Schaefer wrote: >zsh% one="one" >zsh% two="one two" >zsh %echo ${${=one}[1]} ${${=two}[1]} >o one > >This seems unintuitive to me. I was expecting to get the entire word "one" >in both cases. Ceteris paribus, I'd agree with your analysis of the above situation. But to have ${one[1]} expand to "one" when SH_WORD_SPLIT is enabled might be considered worse. OTOH, I've been thinking that it might be better to adopt the ksh view of scalar variables, that they are actually arrays of a single element. That would make ${one[1]} in the above unambiguously refer to "one", and make $= behave as you expected. It would also break a lot of existing scripts in ways that could only partially be fixed by another compatibility option. -zefram