-
Notifications
You must be signed in to change notification settings - Fork 1.8k
SC3047
Vidar Holen edited this page Sep 2, 2020
·
1 revision
(or "In dash, ... is not supported." when using dash
)
Also applies to RETURN and DEBUG.
#!/bin/sh
trap 'Command failed with $?' ERR
Switch to a shell like ksh
or bash
that does support the kind of trap you want:
#!/bin/bash
trap 'Command failed with $?' ERR
Otherwise, rewrite the script to not rely on the trap.
You are trying to install a trap that is not supported by your current shell (dash
or POSIX sh
). There is no simple replacement. The script should be rewritten to avoid depending on the trap, or simply be run with a shell that supports it.
If you only intend to target shells that supports this feature, you can change the shebang to a shell that guarantees support, or ignore this warning.
You can use # shellcheck disable=SC3000-SC4000
to ignore all such compatibility
warnings.
- Help by adding links to BashFAQ, StackOverflow, man pages, POSIX, etc!