Re: [Help-bash] errexit and attempting to change readonly functions
From:
Greg Wooledge
Subject:
Re: [Help-bash] errexit and attempting to change readonly functions
Date:
Fri, 27 Sep 2019 16:43:59 -0400
User-agent:
Mutt/1.10.1 (2018-07-13)
On Fri, Sep 27, 2019 at 09:28:24PM +0100, Stephane Chazelas wrote:
> It seems as if bash tried to avoid triggering errexit when it
> can get away (wrt posix conformance) with not to.
The man page says,
Exit immediately if a pipeline (which may consist of a
single simple command), a list, or a compound command
(see SHELL GRAMMAR above), exits with a non-zero status.
I don't see function declarations included under "compound command"
in that section. So the question, for me, is whether a function
declaration counts as a pipeline, a list, or a compound command (or
none of the above).
I'm about 90% sure it doesn't count as a compound command, since
the grammar for a function declaration includes "compound-command"
right after the "()" part. Not sure about pipeline/list.