recentpopularlog in

Copy this bookmark:

to read

bookmark detail

Bash trap on exit from function - Stack Overflow
Sure enough, it was right there in the docs for 'trap' (and 'return').
Yes, you can trap RETURN :
<code class="language-bash">$ function foo() {
> trap "echo finished" RETURN
> echo "doing some things"
> }</code>
unix  linux  bash  shellscripting  til  traps  solution 
october 2019 by kme
view in context