From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 744 invoked from network); 9 Oct 1997 12:00:17 -0000 Received: from math.gatech.edu (list@130.207.146.50) by ns1.primenet.com.au with SMTP; 9 Oct 1997 12:00:17 -0000 Received: (from list@localhost) by math.gatech.edu (8.8.5/8.8.5) id HAA24657; Thu, 9 Oct 1997 07:52:56 -0400 (EDT) Resent-Date: Thu, 9 Oct 1997 07:52:56 -0400 (EDT) Message-Id: <199710091153.NAA04186@sgi.ifh.de> To: zsh-workers@math.gatech.edu (Zsh hackers list), Bernd Eggink Subject: Re: typeset question In-reply-to: "Bernd Eggink"'s message of "Thu, 09 Oct 1997 12:10:18 MET." <343CAD8A.C6E56ED9@rrz.uni-hamburg.de> Date: Thu, 09 Oct 1997 13:53:33 +0200 From: Peter Stephenson Resent-Message-ID: <"fkrv_.0.916.NMCFq"@math> Resent-From: zsh-workers@math.gatech.edu X-Mailing-List: archive/latest/3568 X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu 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)'. > But this one does _not_ work: > > typeset x=($(cat file)) > Output: > zsh: not an identifier: c) As the outer (...) is not special, the $(cat file) splits the thing into three arguments: x=(a, b and c). typeset complains about the last one. The fix is to do `typeset x' first, then the array assignment to x in a separate statement. -- Peter Stephenson Tel: +49 33762 77366 WWW: http://www.ifh.de/~pws/ Fax: +49 33762 77413 Deutsches Elektronen-Synchrotron --- Institut fuer Hochenergiephysik Zeuthen DESY-IfH, Platanenallee 6, 15738 Zeuthen, Germany.