bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Shell Grammar man page function definition


From: Dale R. Worley
Subject: Re: Shell Grammar man page function definition
Date: Sun, 28 Feb 2021 21:56:05 -0500

Mike Jonkmans <bashbug@jonkmans.nl> 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:
>       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.  The purpose was to stop Bison from giving an annoying
"parse conflict" message when compiling the grammar, but looking at it,
it should allow your example to work, because it gets the parser to
handle all the cases as they are specified in the manual page.

Dale



reply via email to

[Prev in Thread] Current Thread [Next in Thread]