bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: 'time' not recognized as reserved when first word after 'if'


From: Dale R. Worley
Subject: Re: 'time' not recognized as reserved when first word after 'if'
Date: Tue, 10 Jun 2014 09:39:04 -0400

> From: Dan Douglas <address@hidden>
> 
> On Mon, Jun 9, 2014 at 7:51 PM, Dale R. Worley <address@hidden> wrote:
> > But if I add braces around the condition, 'time' is recognized:
> 
> That's not too surprising. That "!" is unaffected is. "if ! ! time :;
> then ..." is an equivalent but working pipeline. "if time { :; };"
> should also be valid but time isn't recognized.

It might not be surprising, but it's incorrect according to the manual
page.

That "! !" works at all is astonishing, because the syntax in the
manual page seems to show that only one "!" is allowed:

              [time [-p]] [ ! ] command [ [|⎪|&] command2 ... ]

Part of the problem is that the manual page defines "simple command",
"pipeline", "list", and "complex command", but it doesn't seem to
define "command", and it is "command" which appears as a component in
the definitions of "pipeline", "list", and "complex command".

E.g., in the above syntax for pipeline, is "command" itself allowed to
be a pipeline (and so it can start with "!") or must it be a simple
command (in which case it can't)?

In addition, the rule for reserved words is:

       Reserved words are words that have a special meaning to the shell.  The
       following words are recognized as reserved when unquoted and either the
       first  word  of a simple command (see SHELL GRAMMAR below) or the third
       word of a case or for command:

But none of the reserved words *are* the first word of a simple
command; they start (and thus are part of) other constructions.  I
think the meaning is "in a location where a simple command could
start", bit it would help if the documentation was clearer.

Dale



reply via email to

[Prev in Thread] Current Thread [Next in Thread]