On 2/19/21 12:56 PM, Robert Elz via austin-group-l at The Open Group wrote:
bash's behaviour is a little weird:
Nope, it's consistent with the standard.
bash5 $ case esac in (esac) echo match -bash: syntax error near unexpected token `esac' bash5 $ esac -bash: syntax error near unexpected token `esac' It is obviously converting the "esac" to Esac, which is correct according to POSIX, but them apparently expecting it to be a pattern, which is not correct, it should be terminating the case statement (as zsh does) making it be that the following ')' is incorrect.
OK. You return the `(' as a token, which, since you're looking for a pattern list, takes you to a state where you apply rule 4. We agree that a fair reading of rule 4 results in Esac, as above, which is a syntax error. There is nothing in the standard that allows you to treat the Esac token in that state as terminating the case statement, nor is there anything that allows you to discard the `('. It's just an error. This is the crux of Geoff's argument: that's not a fair reading of rule 4. -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, UTech, CWRU c...@case.edu http://tiswww.cwru.edu/~chet/