Re: Shell Grammar man page function definition

2021-03-01 Thread Chet Ramey
On 2/28/21 9:56 PM, Dale R. Worley wrote: What does not work: function x ( : ) Check your Bash version. IIRC, recent versions (e.g. 5.1) have a minor change in the Bison grammar (parse.y) for function definitions, IIRC that I provided. This is right; Dale sent the patch. -- ``The

Re: Shell Grammar man page function definition

2021-03-01 Thread Mike Jonkmans
On Sun, Feb 28, 2021 at 05:06:37PM -0500, Chet Ramey wrote: > On 2/28/21 12:38 PM, Mike Jonkmans wrote: > > > The manual page says: > > If the function reserved word is used, but the parentheses are not > > supplied, > > the braces are required. > > That text has been there since the ear

Re: Shell Grammar man page function definition

2021-02-28 Thread Dale R. Worley
Mike Jonkmans writes: > Some examples that work: > function x { :; } ## as expected > function x if :; then :; fi > function x (( 42 )) > function x [[ 42 ]] > function x for x do :; done > function x for (( ; 42 - 42 ; )); do :; done > > What does not work: >

Re: Shell Grammar man page function definition

2021-02-28 Thread Chet Ramey
On 2/28/21 12:38 PM, Mike Jonkmans wrote: The manual page says: If the function reserved word is used, but the parentheses are not supplied, the braces are required. That text has been there since the earliest versions of the man page. It's not strictly true any more, but it's

Re: Shell Grammar man page function definition

2021-02-28 Thread Oğuz
28 Şubat 2021 Pazar tarihinde Mike Jonkmans yazdı: > Hi, > > The manual page says: > If the function reserved word is used, but the parentheses are not > supplied, > the braces are required. > > But it seems that from all the compound commands, > only a subshell is not possible. >

Re: Shell Grammar man page function definition

2021-02-28 Thread Greg Wooledge
Mike Jonkmans (bash...@jonkmans.nl) wrote: > What does not work: > function x ( : ) The parser is looking for () after the function name. Most likely, the opening ( is confusing it. unicorn:~$ bash unicorn:~$ x() ( : ) unicorn:~$ function y() ( : ) unicorn:~$ type x x is a function x () {

Shell Grammar man page function definition

2021-02-28 Thread Mike Jonkmans
Hi, The manual page says: If the function reserved word is used, but the parentheses are not supplied, the braces are required. But it seems that from all the compound commands, only a subshell is not possible. Some examples that work: function x { :; } ## as expected