Chet Ramey <chet.ra...@case.edu> writes:

> On 2/26/18 5:45 AM, moos...@gmail.com 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.

Thank you for an explanation. My takeaway is that most, if not all,
[kaz]sh descendants[1] allow something that IEEE Std 1003.1-2008, 2016
Edition doesn't.

[1] dash,busybox,mksh,zsh

-- 
mailto:moos...@gmail.com

Reply via email to