Handling Signals in bash: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
No edit summary
Line 6: Line 6:


* [[bash#Subjects|bash]]
* [[bash#Subjects|bash]]
* [[Linux Signals]]


=Overview=
=Overview=

Revision as of 19:44, 29 January 2018

External

Internal

Overview

The signals are caught with the trap built-in.

trap '<executable code or function name>' <signal>


...
function sigint() {

  echo "signal INT received"
  exit 0   
}

trap 'sigint' INT
...