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