``` u can try trap '(( $? )) && exit 2' debug ``` I mean, I know that $? doesn't detect the tests I posted in my first email, even if we do
bash -e -c 'echo $(exit 1) ; echo survived' We see that survived is printed, this trap snippet you wrote here seems to duplicate what set -e does? I repeated the tests I had, and the trap doesn't make a difference. My favorite way to track step by step execution is set -x and editing $PS4 of course, but those are just read only debug tools and they can't force bash to exit early. So, from all the replies I see here, I learned that this is not a bug, unfortunately, and is just how set -e works, and trying to do bulletproof status code checking with it is just, not perfect enough, and never will be. Thank you all, the bug report can be marked as resolved not-a-bug.