Open treinen opened 5 years ago
bash
has the same behavior as morbig
. dash
indeed recognizes an if-then-else.
Hum. I would say that dash
is right. Maybe we should ask the POSIX mailing-list about that example?
The sentence explaining that point in the standard is:
After a token has been delimited, but before applying the grammatical rules in Shell Grammar, a resulting word that is identified to be the command name word of a simple command shall be examined to determine whether it is an unquoted, valid alias name.
How can you identify the command name word of a simple command without applying the grammar rules? It does not make sense to me.
there seems to be a problem with the way alias expansion is integrated in the engine. If alias expansion has an impact on the grammatical structure of the script then this is not recognized properly by morbig, at least not in the following example:
Morbig recognizes this as a sequence of simple commands insetad of an if-then-else.