On 07/01/2019 10:10, Geoff Clare wrote:
Okay, so along with a fix for the comment issue you and Harald discussed
recently, here's an updated version of that whole paragraph:

     If the value of the alias is not a simple command (see Section 2.9.1)
     minus the terminating control operator, or if the value is a simple
     command minus the terminating control operator but contains a
     variable assignment or redirection, the behavior is unspecified.
     When a word is subject to alias substitution, the value of the alias
     shall be processed to form tokens (see Section 2.3) and the tokens
     shall replace the word, unless the shell is currently processing an
     alias of the same name, in which case the word shall not be replaced
     in order to prevent infinite loops in recursive aliasing (see below).
     If a comment would be discarded during token recognition, the behavior
     is unspecified.

(This also fixes another problem I noticed, which is that 2.9.1 says a
simple command is "terminated by a control operator".  The terminator
should not be allowed in aliases.)

The description of forming tokens makes sense to me and I think the bit about comments addresses my concerns, thank you.

The thing about control operators is a good point, but really, is it not a bug for Simple Commands to say that a simple command is terminated by a control operator in the first place? All shells accept

  eval "echo hello"

This is a simple command without any control operator to terminate it. The standard itself shows the eval command used that way in its description of that.

It already follows from the grammar that *if* a control operator is seen, it cannot be taken as part of the simple command.

Cheers,
Harald van Dijk

Reply via email to