zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <pws@ifh.de>
To: zsh-workers@math.gatech.edu (Zsh hackers list),
	Bernd Eggink <eggink@rrz.uni-hamburg.de>
Subject: Re: typeset question
Date: Thu, 09 Oct 1997 13:53:33 +0200	[thread overview]
Message-ID: <199710091153.NAA04186@sgi.ifh.de> (raw)
In-Reply-To: "Bernd Eggink"'s message of "Thu, 09 Oct 1997 12:10:18 MET." <343CAD8A.C6E56ED9@rrz.uni-hamburg.de>

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 <pws@ifh.de>       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.


  reply	other threads:[~1997-10-09 12:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-10-09 10:10 Bernd Eggink
1997-10-09 11:53 ` Peter Stephenson [this message]
1997-10-09 13:23   ` Bernd Eggink

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=199710091153.NAA04186@sgi.ifh.de \
    --to=pws@ifh.de \
    --cc=eggink@rrz.uni-hamburg.de \
    --cc=zsh-workers@math.gatech.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).