Jan Schampera wrote:

When you use the third form shown above and use the subshell-grouping
compound command '(...)' as function body, then it doesn't pass the parser:

-----------------------------
$ function name (echo)
bash: syntax error near unexpected token `echo'
-----------------------------

That's the reason I think there's a bug, either in the description or in
the code. Since the rest of the behaviour of function definitions is
very consistent as described in the manual, I assume it's a bug in the code.

It's not.  It's a shift/reduce conflict in the grammar.  The default
yacc/bison behavior is to choose the `function word () command' production,
and I have left it that way.  The `function word command' form came from
ksh, which doesn't allow the construct you used anyway (it requires one
or more newlines after the word), so the current bash implementation
supports all existing ksh uses.

Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer

Chet Ramey, ITS, CWRU    [EMAIL PROTECTED]    http://cnswww.cns.cwru.edu/~chet/


Reply via email to