On 2/26/18 5:45 AM, [email protected] wrote:
> Bash Version: 4.4
> Patch Level: 19
> Release Status: release
>
> Description:
> Bash rejects valid function definitions
>
> Repeat-By:
>
> $ func() true
> bash: syntax error near unexpected token `true'
Yes, bash requires that function bodies be compound commands, as the Posix
grammar specifies.
> # Variant#2
> $ func() { true }
>> ^C
This is not a valid compound command. To be recognized as a reserved word,
and end the group command, the close brace must appear in a context where
a reserved word is valid. The argument to a simple command is not such a
place.
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU [email protected] http://tiswww.cwru.edu/~chet/