* noglob and setting variables
@ 1999-08-04 18:01 Owen M. Astley
1999-08-05 4:28 ` Bart Schaefer
0 siblings, 1 reply; 2+ messages in thread
From: Owen M. Astley @ 1999-08-04 18:01 UTC (permalink / raw)
To: zsh-workers
Is this a bug or a feature?
In a directory with 32 files...
alpha3-~% a=(*)
alpha3-~% echo $#a
32
alpha3-~% noglob a=(*)
zsh: command not found: a=(*)
alpha3-~% noglob set -A a *
alpha3-~% echo $#a
1
So assignment using '=' doesn't appear to be a command. What is it
then?
This is on zsh-3.0.5.
Owen
^ permalink raw reply [flat|nested] 2+ messages in thread
* 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
end of thread, other threads:[~1999-08-05 4:28 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-08-04 18:01 noglob and setting variables Owen M. Astley
1999-08-05 4:28 ` Bart Schaefer
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).