Skip to content

Instantly share code, notes, and snippets.

@vrivellino
Created March 18, 2015 19:46
Show Gist options
  • Save vrivellino/0bba7eb2d47a738d1637 to your computer and use it in GitHub Desktop.
Save vrivellino/0bba7eb2d47a738d1637 to your computer and use it in GitHub Desktop.
bash trap test
#!/bin/bash
trap "echo SIGNAL 1" 1
trap "echo SIGNAL SIGHUP" SIGHUP
trap "echo SIGNAL 2" 2
trap "echo SIGNAL SIGINT" SIGINT
trap "echo SIGNAL 3" 3
trap "echo SIGNAL SIGQUIT" SIGQUIT
trap "echo SIGNAL 4" 4
trap "echo SIGNAL SIGILL" SIGILL
trap "echo SIGNAL 5" 5
trap "echo SIGNAL SIGTRAP" SIGTRAP
trap "echo SIGNAL 6" 6
trap "echo SIGNAL SIGABRT" SIGABRT
trap "echo SIGNAL 7" 7
trap "echo SIGNAL SIGEMT" SIGEMT
trap "echo SIGNAL 8" 8
trap "echo SIGNAL SIGFPE" SIGFPE
trap "echo SIGNAL 9" 9
trap "echo SIGNAL SIGKILL" SIGKILL
trap "echo SIGNAL 10" 10
trap "echo SIGNAL SIGBUS" SIGBUS
trap "echo SIGNAL 11" 11
trap "echo SIGNAL SIGSEGV" SIGSEGV
trap "echo SIGNAL 12" 12
trap "echo SIGNAL SIGSYS" SIGSYS
trap "echo SIGNAL 13" 13
trap "echo SIGNAL SIGPIPE" SIGPIPE
trap "echo SIGNAL 14" 14
trap "echo SIGNAL SIGALRM" SIGALRM
trap "echo SIGNAL 15" 15
trap "echo SIGNAL SIGTERM" SIGTERM
trap "echo SIGNAL 16" 16
trap "echo SIGNAL SIGURG" SIGURG
trap "echo SIGNAL 17" 17
trap "echo SIGNAL SIGSTOP" SIGSTOP
trap "echo SIGNAL 18" 18
trap "echo SIGNAL SIGTSTP" SIGTSTP
trap "echo SIGNAL 19" 19
trap "echo SIGNAL SIGCONT" SIGCONT
trap "echo SIGNAL 20" 20
trap "echo SIGNAL SIGCHLD" SIGCHLD
trap "echo SIGNAL 21" 21
trap "echo SIGNAL SIGTTIN" SIGTTIN
trap "echo SIGNAL 22" 22
trap "echo SIGNAL SIGTTOU" SIGTTOU
trap "echo SIGNAL 23" 23
trap "echo SIGNAL SIGIO" SIGIO
trap "echo SIGNAL 24" 24
trap "echo SIGNAL SIGXCPU" SIGXCPU
trap "echo SIGNAL 25" 25
trap "echo SIGNAL SIGXFSZ" SIGXFSZ
trap "echo SIGNAL 26" 26
trap "echo SIGNAL SIGVTALRM" SIGVTALRM
trap "echo SIGNAL 27" 27
trap "echo SIGNAL SIGPROF" SIGPROF
trap "echo SIGNAL 28" 28
trap "echo SIGNAL SIGWINCH" SIGWINCH
trap "echo SIGNAL 29" 29
trap "echo SIGNAL SIGINFO" SIGINFO
trap "echo SIGNAL 30" 30
trap "echo SIGNAL SIGUSR1" SIGUSR1
trap "echo SIGNAL 31" 31
trap "echo SIGNAL SIGUSR2" SIGUSR2
while sleep 1; do
sleep 1
done
echo done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment