Sample Header Ad - 728x90

Default exit code when process is terminated?

83 votes
4 answers
105633 views
When a process is killed with a handle-able signal like SIGINT or SIGTERM but it does not handle the signal, what will be the exit code of the process? What about for unhandle-able signals like SIGKILL? From what I can tell, killing a process with SIGINT likely results in exit code 130, but would that vary by kernel or shell implementation? $ cat myScript #!/bin/bash sleep 5 $ ./myScript $ echo $? 130 I'm not sure how I would test the other signals... $ ./myScript & $ killall myScript $ echo $? 0 # duh, that's the exit code of killall $ killall -9 myScript $ echo $? 0 # same problem
Asked by Cory Klein (19341 rep)
Nov 6, 2013, 05:42 PM
Last activity: May 8, 2023, 10:00 AM