Re: return exit code in EXIT trap

2022-08-06 Thread Robert E. Griffith
On 8/5/22 21:49, Koichi Murase wrote: 2022年8月3日(水) 21:19 Robert E. Griffith : That was an interesting read. The illuminating point for me was the statement to the effect of "the POSIX specification is not meant to describe what it correct or rational, but what historically has been implemented s

Re: return exit code in EXIT trap

2022-08-06 Thread Robert E. Griffith
Hmmm.. I just got confused when I went to do a test... $ trap 'echo hi; return' SIGUSR2 $ kill -SIGUSR2 $$ hi bash: return: can only `return' from a function or sourced script $ $ echo $BASH_VERSION 5.0.17(1)-release I also confirmed the same error in the DEBUG trap where you s

Re: return exit code in EXIT trap

2022-08-06 Thread Koichi Murase
2022年8月7日(日) 1:02 Robert E. Griffith : > Where can we use 'return' directly in a trap script? What am I not getting? It is described in the very original thread: https://lists.gnu.org/archive/html/bug-bash/2014-03/msg00053.html -- Koichi

Re: return exit code in EXIT trap

2022-08-06 Thread Robert Elz
Date:Sat, 6 Aug 2022 12:02:07 -0400 From:"Robert E. Griffith" Message-ID: <5a091673-5e70-baee-0874-1c8c5ec88...@junga.com> | Where can we use 'return' directly in a trap script? What am I not getting? I suspect that if you want specified behaviour, the answer is no

Re: return exit code in EXIT trap

2022-08-06 Thread Robert E. Griffith
On 8/6/22 14:44, Robert Elz wrote: ... bash allows a return in the trap string (not in a function called in that string) if the trap occurs while executing a function (then the return applies to that function). ... Yes! that is what I was missing.  Years ago when I wrote my debugger, I must hav