* Re: noglob and setting variables
1999-08-04 18:01 noglob and setting variables Owen M. Astley
@ 1999-08-05 4:28 ` Bart Schaefer
0 siblings, 0 replies; 2+ messages in thread
From: Bart Schaefer @ 1999-08-05 4:28 UTC (permalink / raw)
To: Owen M. Astley, zsh-workers
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
^ permalink raw reply [flat|nested] 2+ messages in thread