Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: typeset question
- X-seq: zsh-workers 3568
- From: Peter Stephenson <pws@xxxxxx>
- To: zsh-workers@xxxxxxxxxxxxxxx (Zsh hackers list), Bernd Eggink <eggink@xxxxxxxxxxxxxxxxxx>
- Subject: Re: typeset question
- Date: Thu, 09 Oct 1997 13:53:33 +0200
- In-reply-to: "Bernd Eggink"'s message of "Thu, 09 Oct 1997 12:10:18 MET." <343CAD8A.C6E56ED9@xxxxxxxxxxxxxxxxxx>
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@xxxxxx> 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.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author