Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #13752 > unrolled thread

Re: Function definitions

Started bymoosotc@gmail.com
First post2018-02-26 18:24 +0300
Last post2018-02-26 18:24 +0300
Articles 1 — 1 participant

Back to article view | Back to gnu.bash.bug

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Function definitions moosotc@gmail.com - 2018-02-26 18:24 +0300

#13752 — Re: Function definitions

Frommoosotc@gmail.com
Date2018-02-26 18:24 +0300
SubjectRe: Function definitions
Message-ID<mailman.9754.1519658661.27995.bug-bash@gnu.org>
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

[toc] | [standalone]


Back to top | Article view | gnu.bash.bug


csiph-web