Is it possible to detect *which* trap signal in bash?
bash, bash-trap
Solution
No documentation hints of any argument or variable holding the signal that was trapped, so you'll have to write a function/trap statement for each trap you want to behave differently.
Problem
Possible Duplicate: Identifying received signal name in bash shell script When using something like `trap func_trap INT TERM EXIT` with: ``` func_trap () { ...some commands... } ``` Is there a way in the function block to detect which trap has called it? Something like: ``` func_trap () { if signal = INT; then # do this else # do that fi } ``` Or do I need to write a separate function for each trap type that does something different? Is there a bash variable that holds the latest received signal? Thanks in advance!