Handling Signals in bash: Difference between revisions
Jump to navigation
Jump to search
Line 12: | Line 12: | ||
trap '<''executable code or function name''>' <''signal''> | trap '<''executable code or function name''>' <''signal''> | ||
function sigint() { | |||
echo "signal INT received" | |||
exit 0 | |||
} | |||
trap 'sigint' INT |
Revision as of 19:43, 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