Is it possible to enforce a certain exit code when using "kill" to stop a process?
Tell me more
×
Super User is a question and answer site for
computer enthusiasts and power users. It's 100% free, no registration required.
|
|
This will exit with a 42 if any of the listed signals are received. You could perform other actions including calling a function, etc.
|
|||||||
|
|
Yes, you have the trap the kill signals you send to your script using the trap command, see man bash and look for the trap command. After "trapping" the signal sent to the script, you could exit with any value you want to. |
|||
|
|