diff --git a/SC2251.md b/SC2251.md index 0be5b47..d651fac 100644 --- a/SC2251.md +++ b/SC2251.md @@ -27,8 +27,8 @@ Adding `|| exit ` will instead exit with failure when the command succeeds. ShellCheck will not detect cases where `$?` is implicitly or explicitly used to check the value afterwards: -``` -set -e; +```sh +set -e check_success() { [ $? -eq 0 ] || exit 1; } ! false; check_success ! true; check_success