May 2018
Beginner
332 pages
7h 28m
English
Let's reassign our function to signals with the trap command:
$ trap 'echo "You pressed Control key" ' 0 1 2 15
If we do not pass any arguments after the trap command, then it lists all reassigned signals along with their functions.
We can list all the assigned signal lists with the following command:
$ trap
Output:
trap -- 'echo "You pressed Control key" ' EXIT
trap -- 'echo "You pressed Control key" ' SIGHUP
trap -- 'echo "You pressed Control key" ' SIGINT
trap -- 'echo "You pressed Control key" ' SIGTERM