SC3048 – ShellCheck Wiki

See this page on GitHub

Sitemap


In POSIX sh, prefixing signal names with 'SIG' is undefined.

(or "In dash, ... is not supported." when using dash)

Problematic code:

trap 'handle_interrupt' SIGINT

Correct code:

trap 'handle_interrupt' INT

Rationale:

POSIX does not allow specifying the "SIG" prefix of a signal name like "INT". Bash and Ksh supports this as an extension.

Simply remove the "SIG" from the signal name.

Exceptions:

None


ShellCheck is a static analysis tool for shell scripts. This page is part of its documentation.