Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: noglob and setting variables
- X-seq: zsh-workers 7361
- From: "Bart Schaefer" <schaefer@xxxxxxxxxxxxxxxxxxxxxxx>
- To: "Owen M. Astley" <oma1000@xxxxxxxxx>, zsh-workers@xxxxxxxxxxxxxx
- Subject: Re: noglob and setting variables
- Date: Thu, 5 Aug 1999 04:28:41 +0000
- In-reply-to: <Pine.OSF.3.96.990804185405.2268A-100000@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxxxxxx; run by ezmlm
- References: <Pine.OSF.3.96.990804185405.2268A-100000@xxxxxxxxxxxxxxxxxxxxxxxxx>
On Aug 4, 7:01pm, Owen M. Astley wrote:
} Subject: noglob and setting variables
}
} Is this a bug or a feature?
Neither, really ...
} alpha3-~% noglob a=(*)
} zsh: command not found: a=(*)
}
} So assignment using '=' doesn't appear to be a command. What is it
} then?
It's an assignment. The manual says:
A "simple command" is a sequence of optional parameter assignments
followed by blank-separated words, with optional redirections
interspersed. The first word is the command to be executed, and the
remaining words, if any, are arguments to the command.
The arguments to "noglob" are interpreted as a command to be executed and
its arguments, not as a complete "simple command." This is a consequence
of a decision made by Zoltan way back in June 1996, that "noglob" would
become a builtin rather than a reserved word. (PWS actually wrote the
patch.)
Before that, the form you tried probably did work, but things like
zsh% FOO=exec ; $FOO something
did NOT work, because of the order in which globbing and subsitutions had
to be done (or not) when parsing a line of input. See zsh-workers/1229 in
the archives, and follow the thread back and forth.
In addition to `noglob set -A a *` another way to get the effect you want
is
zsh% : ${(A)a=*}
--
Bart Schaefer Brass Lantern Enterprises
http://www.well.com/user/barts http://www.brasslantern.com
Messages sorted by:
Reverse Date,
Date,
Thread,
Author