Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > gnu.bash.bug > #13752
| From | moosotc@gmail.com |
|---|---|
| Newsgroups | gnu.bash.bug |
| Subject | Re: Function definitions |
| Date | 2018-02-26 18:24 +0300 |
| Message-ID | <mailman.9754.1519658661.27995.bug-bash@gnu.org> (permalink) |
| References | <877er0qbb7.fsf@gmail.com> <3f544894-f4e2-4c51-9202-6a6e92ae8ebb@case.edu> |
Chet Ramey <chet.ramey@case.edu> writes:
> On 2/26/18 5:45 AM, moosotc@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:moosotc@gmail.com
Back to gnu.bash.bug | Previous | Next | Find similar | Unroll thread
Re: Function definitions moosotc@gmail.com - 2018-02-26 18:24 +0300
csiph-web