$RodHat_/search
exit code reference

Exit 130 SIGINT (128 + 2)

Interrupted from the keyboard (Ctrl-C).

Value
130
Convention
Killed by a signal (128 + N)
Signal
SIGINT (Linux 2, FreeBSD 2)

Bash reports 130 when the foreground command died of SIGINT. Well-behaved programs clean up and then re-raise the signal so the parent sees a signal death rather than a plain exit. A script that traps SIGINT and exits 1 hides that from its caller, which is why a Ctrl-C can fail to stop the loop that called it.

What to check

sleep 100  # press Ctrl-C, then: echo $?

Rod on this

Sources

  1. Exit Status, GNU Bash manual
  2. signal(7), Linux man-pages

Exit codes are conventions, not guarantees: a program can return any value from 0 to 255. Spot one that's wrong? Tell Rod.