Hi Martin, Long answer - my own view: The old 'errexit' logic was spec'ed many years ago. As far as I can tell, it existed in bash 2.0, from 1996. I think requirements/expectations are different now. The 'exit on error' error handling was good for 1996 - does not meet today's requirement - using bash to glue complex systems together. For that reason, I do not think that replicating the errexit small details is a good strategy. In fact, I think that most developers are looking for something that is closer to the "try ... catch" that they have in other environments. The 'errfail' is my proposal to get there, without introducing lsignificant changes, or risk.
Re: command prefaced by ! which is important: * The '!' operator 'normal' behavior is to reverse the exit status of a command ('if ! check-something ; then ...'). * I do not think it's a good idea to change the meaning of '!' when running with 'error checking'. * I think that the existing structures ('|| true', or '|| :') to force success status are good enough and well understood by beginner and advanced developers. Question: What is the penalty for "|| true" ? true is bash builtin, and in bash it's equivalent to ':'. (see: https://unix.stackexchange.com/questions/34677/what-is-the-difference-between-and-true ) Re: yet another global setting is perpetuating the "wrong direction". I prefer not to get into "flame war" on the issue of dynamic scope vs. lexical scope. Most other scripting solutions that I'm familiar with are using dynamic (rather than lexical) scoping for 'try ... catch.'. Considering that bash is stable, I do not think that it is realistic to try to expect major changes to 'bash'. Also, Bash code was developed with specific design/requirements in mind. It can not be easily stretched to integrate new ideas - sometimes it is better to go for practical solutions than for the best solution. There is a big range of applications where bash can play an important role. For a more sophisticated environment, python, groovy, javascript or (your favorite choice) might be a better solution. Question: Out of curiosity, can you share your idea for a better solution ? Thanks for taking the time ! Yair Sent from my iPad On Jul 8, 2022, at 3:31 PM, Martin D Kealey <mar...@kurahaupo.gen.nz> wrote: The old errexit explicitly exempts any command prefaced by ! which is important so that one can write ! (( x++ )) without it blowing up when x is 0 and without paying the penalty for "|| true". Does this new proposal honour that? Aside from that, I still think that yet another global setting is perpetuating the "wrong direction"; "local -" has the same dynamic scope as any other "local", which means magic action at a difference, and makes brittle code that can abort unexpectedly in production. -Martin