Re: [Help-bash] errexit and attempting to change readonly functions
From:
Andreas Kusalananda Kähäri
Subject:
Re: [Help-bash] errexit and attempting to change readonly functions
Date:
Tue, 1 Oct 2019 20:16:13 +0200
User-agent:
Mutt/1.12.2 (2019-09-21)
On Tue, Oct 01, 2019 at 11:23:01AM -0400, Chet Ramey wrote:
> On 9/27/19 6:12 AM, Andreas Kusalananda Kähäri wrote:
> > A function can be made read-only with
> >
> > readonly -f func
> >
> > This stops it from being unset or redefined:
> >
> > $ func () { echo hello; }
> > bash: func: readonly function
> >
> > However, with the errexit shell option set, I would expect the shell
> > to exit when doing this
>
> It's an oversight, probably dating back to when POSIX only required the
> shell to exit if a simple command failed when errexit is enabled. I'll
> change it for the next release.
>
> Chet
I appreciate all the responses, and thanks
also to Chet for looking into it.
Regards,
Kusalananda