Handling Signals in bash

From NovaOrdis Knowledge Base
Revision as of 19:43, 29 January 2018 by Ovidiu (talk | contribs)
Jump to navigation Jump to search

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
...