The POSIX shell standard grammar rules are at
Shell Command Language
I am trying to understand Rule 7 and I don't. I think there may be some mistakes there. I am not complaining about the standard; rather, I am concerned that my perception is wrong, and I don't understand something important.
Here are my questions. Please tell me for each question, if the standard is simply written incorrectly, or what is it that I don't understand.
1. Rule 7 is only referenced with yacc symbols cmd_name and cmd_word, not with any symbols that have to do with assignments, yet it is labeled "Assignment preceding command name". Is that a misleading label ?
2. Rule 7a for the first word, in some cases refers to Rule 7b, which is labeled "not the first word". Is that a misleading label ?
3. The yacc symbol cmd_word refers to rule 7b, which says, if the word contains '=' after its first character, then it is an assignment - and not anything to do with a command. Should rule 7b simply state that it is not allowed to have '=' after the first character?
4. Rule 7a is only referenced during parsing simple commands, which cannot have any reserved words in them. Yet Rule 7a in some cases refers to Rule 1, which differentiates between a reserved word and ordinary word.
If there is no possibility of having a reserved word in Rule 7a, there would be no point to refer to any additional Rule 1 at all. Then, there would be no point in having a separate Rule 7a at all. That is because, if the word did not contain '=', Rule 7b says nothing, so we have WORD, and if it did contain '=', then 7b applies. Thus we would only need 7b. Then also, there would be no need for cmd_name symbol, we could just have cmd_word.
Is Rule 7a and cmd_name symbol needed?
Moderator's Comments:
|
|
edit by bakunin: made the link working.
|
|