S
S
Serious Shell Programming
Search…
S
S
Serious Shell Programming
Introduction
Acknowledgements
Basics
Strings
Here Documents
Conditionals
Regex
Control Flow
shellcheck
Introduction
Bad Advice
Style
awk
case
Redirection
Comments
trap
String Functions
substr
sprintf
replace
replaceall
replacestart
replaceend
fnmatch
awk
Pre-declaring Arrays
Sorting Arrays
Know Your limits
Arguments
Environment Variables
Solutions
Powered By
GitBook
trap
The
trap
shell built-in supports numbers (
0
,
1
,
2
,
3
,
15
, etc), long names (
EXIT
,
SIGHUP
,
SIGINT
,
SIGQUIT
,
SIGTERM
, etc), and short names (
EXIT
,
HUP
,
INT
,
QUIT
,
TERM
, etc). Use long names:
1
trap "echo EXIT" EXIT
2
trap "echo received hangup signal" SIGHUP
3
trap "echo received interrupt signal" SIGINT
4
trap "echo received quit signal" SIGQUIT
5
trap "echo received terminate signal" SIGTERM
Copied!
Style - Previous
Comments
Next - String Functions
substr
Last modified
2yr ago
Copy link