From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1099 invoked from network); 9 Oct 1997 13:29:50 -0000 Received: from math.gatech.edu (list@130.207.146.50) by ns1.primenet.com.au with SMTP; 9 Oct 1997 13:29:50 -0000 Received: (from list@localhost) by math.gatech.edu (8.8.5/8.8.5) id JAA26141; Thu, 9 Oct 1997 09:22:52 -0400 (EDT) Resent-Date: Thu, 9 Oct 1997 09:22:52 -0400 (EDT) Sender: rz2a022@rrz.uni-hamburg.de Message-Id: <343CDAD8.CB7DDBF@rrz.uni-hamburg.de> Date: Thu, 09 Oct 1997 15:23:36 +0200 From: Bernd Eggink Organization: RRZ Uni Hamburg X-Mailer: Mozilla 4.03 [en] (X11; I; AIX 4.1) Mime-Version: 1.0 To: zsh-workers mailing list Cc: Peter Stephenson Subject: Re: typeset question References: <199710091153.NAA04186@sgi.ifh.de> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Resent-Message-ID: <"QImYl2.0.OO6.igDFq"@math> Resent-From: zsh-workers@math.gatech.edu X-Mailing-List: archive/latest/3569 X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu Peter Stephenson wrote: > > Bernd Eggink wrote: > > I'm confused... These two statements work fine and give the same > > results: > > > > typeset x=(a b c) > > > > x=($(cat file)) > > Actually, the first is not an array assignment; there is nothing > syntactically special about the parentheses in a typeset statement. > (In fact, it does grouping in all statements, to make globs using > parentheses work sensibly, which is why the spaces don't separate words, > but even so typeset just gets the string `x=(a b c)'). You should find > x contains the string '(a b c)'. My confusion was caused by a curious property of 'typeset'. If the variable is already defined as a normal variable, and if it is an array, typeset does _nothing_. In all other cases it works as expected. Try this: x=a typeset x=b print $x # prints: b OK... Now try unset x x=(a b c) typeset x=(x y z) print $x # prints: a b c The contents of the brace gets evaluated, but no assignment takes place. Bug or feature? It's not documented nor does it make sense to me. -- Bernd Eggink Regionales Rechenzentrum der Uni Hamburg eggink@rrz.uni-hamburg.de http://www.rrz.uni-hamburg.de/eggink/BEggink.html