Is there a way in bash to guarantee that a trap gets called for cleanup in a script?
I have a script that works perfectly normally and cleans up after itself, even if it goes wrong. However on trying to debug something else, I wanted to run it like this: ./script |& tee log and now it doesn't clean up if I <ctrl c> it. Is there a way in bash to guarantee (modulo uncatchable signals) that a cleanup routine gets called?