Ignoring signals

If we want the shell to ignore certain signals, then we can call the trap command followed by a pair of empty quotes as a command. Those signals will be ignored by the shell process shown by either of the following commands:

    $ trap " " 2 3 20
    $ trap " " INT QUIT TSTP

The signals 2 (SIGINT), 3 (SIGQUIT), and 20 (SIGTSTP) will be ignored by the shell process.

Get Learning Linux Shell Scripting - Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.