hello there ..
to return $( and maybe <( use wait -n

bash -e -c $'trap \'wait -n ; (( $? )) && exit 1\' debug ; echo $(exit 1) ;
echo survived'
$ u0_a427/10427 localhost 09:24:18 19.06.2025
~


<no survived>

On Thu, Jun 19, 2025, 12:39 AM Никола Константинов Кралев <
nkkra...@uni-sofia.bg> wrote:

> ```
> 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.
>
  • set -e doesn't ... nkkralev--- via Bug reports for the GNU Bourne Again SHell
    • Re: set -e... Greg Wooledge
      • Re: se... Steffen Nurpmeso
        • Re... microsuxx
          • ... nkkralev--- via Bug reports for the GNU Bourne Again SHell
            • ... microsuxx
              • ... microsuxx
                • ... nkkralev--- via Bug reports for the GNU Bourne Again SHell
                • ... Lawrence Velázquez
              • ... Robert Elz
    • Re: set -e... Chet Ramey

Reply via email to