For the lexical analysis in a POSIX shell, from http://pubs.opengroup.org/onlinepubs/007904875/utilities/xcu_chap02.html
7. [Assignment preceding command name]
a. [When the first word]
If the TOKEN does not contain the character ’=’, rule 1 is applied. Otherwise, 7b shall be applied.
b. [Not the first word]
If the TOKEN contains the character:
— If it begins with ’=’, the token WORD shall be returned.
— If all the characters preceding ’=’ form a valid name (see XBD Section 3.231), the token ASSIGNMENT_WORD shall be returned. (Quoted characters cannot participate in forming a valid name.)
— Otherwise, it is unspecified whether it is ASSIGNMENT_WORD or WORD that is returned. Assignment to the NAME shall occur as specified in Section 2.9.1.
What does 'the first word' mean?
What case is 'When the first word'?
What case is 'Not the first word'?
- 'When the first word', What case is 'If the TOKEN does not contain the character ’=’'?
When 'Not the first word',
What case is 'If it begins with ’=’'?
What case is 'Otherwise'?