From 1fe45d48b1a898df751473638b28c3553ca6d169 Mon Sep 17 00:00:00 2001 From: koalaman Date: Sat, 31 Oct 2015 17:30:54 -0700 Subject: [PATCH] Created SC2172 (markdown) --- SC2172.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 SC2172.md diff --git a/SC2172.md b/SC2172.md new file mode 100644 index 0000000..1457245 --- /dev/null +++ b/SC2172.md @@ -0,0 +1,22 @@ +## Trapping signals by number is not well defined. Prefer signal names. + +### Problematic code: + +```sh +trap myfunc 28 +``` + +### Correct code: + +```sh +trap myfunc WINCH +``` +### Rationale: + +Signal numbers can vary between platforms. Prefer signal names, which are fixed. + +Signal numbers 1, 2, 3, 6, 9, 14 and 15 are specified as parts of the optional POSIX XSI and ShellCheck will not warn about these. + +### Exceptions: + +None. \ No newline at end of file