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


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

Re: Function definitions

Started byChet Ramey <chet.ramey@case.edu>
First post2018-02-26 09:20 -0500
Last post2018-02-26 09:20 -0500
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 Chet Ramey <chet.ramey@case.edu> - 2018-02-26 09:20 -0500

#13749 — Re: Function definitions

FromChet Ramey <chet.ramey@case.edu>
Date2018-02-26 09:20 -0500
SubjectRe: Function definitions
Message-ID<mailman.9751.1519654865.27995.bug-bash@gnu.org>
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.

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
		 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet@case.edu    http://tiswww.cwru.edu/~chet/

[toc] | [standalone]


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


csiph-web