Skip to content

Instantly share code, notes, and snippets.

@sputnick-dev
Last active April 22, 2023 02:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sputnick-dev/7260ac0aa46f067f469ee8184b69acb3 to your computer and use it in GitHub Desktop.
Save sputnick-dev/7260ac0aa46f067f469ee8184b69acb3 to your computer and use it in GitHub Desktop.
#!/bin/sh
# Know which signal is caught
# man 7 signal
# The signals SIGKILL and SIGSTOP cannot be caught, blocked, or ignored. (9, 19]
trap "echo 'SIGHUP 1 Term Hangup (disconnection) or control process termination.'" 1
trap "echo 'SIGINT 2 Term Interrupt from keyboard.'" 2
trap "echo 'SIGQUIT 3 Core Quit request from keyboard.'" 3
trap "echo 'SIGILL 4 Core Illegal instruction.'" 4
trap "echo 'signal 5 not referenced'" 5
trap "echo 'SIGABRT 6 Core Abort signal from abort(3).'" 6
trap "echo 'signal 7 not referenced'" 7
trap "echo 'SIGFPE 8 Core Floating point arithmetic error.'" 8
trap "echo 'signal 10 not referenced'" 10
trap "echo 'SIGSEGV 11 Core Invalid memory reference.'" 11
trap "echo 'signal 12 not referenced'" 12
trap "echo 'SIGPIPE 13 Term Write on a pipe with no reader.'" 13
trap "echo 'SIGALRM 14 Term Alarm clock signal (used by alarm(2)).'" 14
trap "echo 'SIGTERM 15 Term Termination signal.'" 15
trap "echo 'SIGUSR1 30,10,16 Term User-defined signal 1.'" 30 10 16
trap "echo 'SIGUSR2 31,12,17 Term User-defined signal 2.'" 31 12 17
trap "echo 'SIGCHLD 20,17,18 Ign Child stopped or terminated.'" 20 17 18
trap "echo 'SIGCONT 19,18,25 Cont Continue if stopped.'" 19 18 25
trap "echo 'SIGTSTP 18,20,24 Stop Stop signal generated from keyboard.'" 18 20 24
trap "echo 'SIGTTIN 21,21,26 Stop Background process attempting to read from tty.'" 21 21 26
trap "echo 'SIGTTOU 22,22,27 Stop Background process attempting to write to tty.'" 22 22 27
trap "echo 'SIGWINCH 28,28,20 Ign Window resize signal (4.3 BSD, Sun).'" 28 20
read _
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment