Is there a way to check what trap
s have been set (in the current session or script) in Bash?
Ideally, I'd like to be able to get a list of the signals that have a trap
assigned to them, but if that's not possible I can just check each signal individually.
Yes.
You can either see all traps, or traps for a specific signal:
$ trap # show all traps for all signals
$ trap -p SIGINT # only show traps for SIGINT
$ trap -p EXIT # only show traps for EXIT
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With