zsh-workers
 help / color / mirror / code / Atom feed
* Parsing error on parsing 'A=1 time'
@ 2019-06-20 10:14 ` Emil Gedda
  2019-06-20 11:04   ` Peter Stephenson
  0 siblings, 1 reply; 2+ messages in thread
From: Emil Gedda @ 2019-06-20 10:14 UTC (permalink / raw)
  To: zsh-workers

$ zsh -c 'A=1 time'
zsh:1: parse error near `time'


Compared to:

$ zsh -c 'A=1; time'
shell  0.00s user 0.01s system 295% cpu 0.003 total
children  0.00s user 0.00s system 0% cpu 0.003 total


This seems to be specific to the time builtin when prepended with a env var
assignment, echo works properly. Could not find a ticket related to this on
sourceforge, my apologies if it has been reported before.

zsh 5.7.1 (x86_64-apple-darwin17.7.0)

Cheers,
Emil

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Parsing error on parsing 'A=1 time'
  2019-06-20 10:14 ` Parsing error on parsing 'A=1 time' Emil Gedda
@ 2019-06-20 11:04   ` Peter Stephenson
  0 siblings, 0 replies; 2+ messages in thread
From: Peter Stephenson @ 2019-06-20 11:04 UTC (permalink / raw)
  To: zsh-workers, Emil Gedda

On Thu, 2019-06-20 at 10:14 +0000, Emil Gedda wrote:
> $ zsh -c 'A=1 time'
> zsh:1: parse error near `time'

It's a little obscure, but this isn't actually a bug.  If you look in
the appropriate manual section, you'll see that "time" is defined as a
"complex command" which takes a pipeline as an argument.  So assignments
etc. come after it (and potentially a number of "|"s with their own
command lines that may include assignemnets).

To put it another way, the parse error here is roughly similar to the
failure you get here:

A=1 { echo; }

In both cases, no command line can appear before the complex command.

pws


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-06-20 11:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20190620101612epcas1p3cc8576152f0692b019570469379111e5@epcas1p3.samsung.com>
2019-06-20 10:14 ` Parsing error on parsing 'A=1 time' Emil Gedda
2019-06-20 11:04   ` Peter Stephenson

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).