[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [RFC] Logically composable variant of errexit
From: |
Chet Ramey |
Subject: |
Re: [RFC] Logically composable variant of errexit |
Date: |
Thu, 09 Oct 2014 21:29:57 -0400 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 |
On 10/9/14, 8:20 AM, Andreas Grünbacher wrote:
> Hi all,
>
> the errexit option can be very useful in simple scripts. This option
> is being ignored in many contexts like lists and conditionals though.
> I understand that this is "by design" and that errexit cannot be
> "fixed" to behave more reasonably. Still, this makes bash a lot less
> useful than it could be; working around this limitation is painful,
> ugly, and leads to fragile code.
>
> So, since we cannot "fix" errexit, can we maybe introduce another
> option like "errfail" that behaves like errexit for simple commands,
> but is also logically composable? Let me show what I mean with the
> following pseudo-code:
What does logically composable mean in this context?
Maybe it would be better if you described how you would like the behavior
to differ from errexit. Like Angel, I see that you want errfail to be
`inherited' by functions, like errexit; inhibited in the same set of
exceptions; but that command substitution failures will cause the shell
to exit. Is that accurate?
Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU chet@case.edu http://cnswww.cns.cwru.edu/~chet/