Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > gnu.bash.bug > #13749
| From | Chet Ramey <chet.ramey@case.edu> |
|---|---|
| Newsgroups | gnu.bash.bug |
| Subject | Re: Function definitions |
| Date | 2018-02-26 09:20 -0500 |
| Message-ID | <mailman.9751.1519654865.27995.bug-bash@gnu.org> (permalink) |
| References | <877er0qbb7.fsf@gmail.com> |
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/
Back to gnu.bash.bug | Previous | Next | Find similar | Unroll thread
Re: Function definitions Chet Ramey <chet.ramey@case.edu> - 2018-02-26 09:20 -0500
csiph-web