Dealing with Signals
A program can deal with a signal in three ways:
Do nothing and let the default action occur. This is the simplest method for a program to deal with a signal because it requires no extra code.
Ignore the signal and continue executing. This method is not the same as doing nothing because ignoring a signal requires the program to have some code that explicitly ignores the signal.
Catch the signal and perform some signal-specific commands. This method requires the program to define a function that is executed when a signal is received. This is the most complex and powerful method of dealing with a signal.
The first method is the default behavior for all shell scripts. All the scripts that you have looked at thus far handle signals ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access