Date: Mon, 27 Apr 2020 22:03:47 -0400 From: wor...@alum.mit.edu (Dale R. Worley) Message-ID: <87pnbsfjss....@hobgoblin.ariadne.com>
| While I was looking at the details of parsing function definitions, I | tripped on something I should have noticed long ago. In the function | definition | | function foo() { | command | } I think this is your problem. The definition of a function is really name ( ) compound-command and in the ksh/bash variant version function name ( ) compound-command There are no braces in the syntax (and I omitted redirections which are not relevant here). When looking for a "compound-command" we start out looking for the first word of a command, and that's exactly where a reserved word can be found. Some shells actually permit name ( ) command instead where it is even clearer (but which gives rise to one small, and mostly irrelevant, ambiguity - also not relevant here.) Note that the text you quoted: Reserved words are words that have a special meaning to the shell. The following words are recognized as reserved when unquoted and either the first word of a simple command ... note that "first word" has nothing to do with lines, that the "name ()" comes earlier doesn't mean that a command (or compound-command) doesn't follow, and that thing starts with a "first word" (of itself). kre