Updated SC2251 (markdown)

Vidar Holen
2019-05-22 17:24:49 -07:00
parent 2ebf1822a7
commit 92f35b00c6

@@ -20,6 +20,8 @@ ShellCheck has found a command inverted with `!` that may have no effect. In par
The most common reason for this is thinking that it'll trigger `set -e` aka `errexit` if a command succeeds, as in the example. This is not the case: `!` will inhibit errexit both on success and failure of the inverted command. The most common reason for this is thinking that it'll trigger `set -e` aka `errexit` if a command succeeds, as in the example. This is not the case: `!` will inhibit errexit both on success and failure of the inverted command.
Wrapping such an inverted command in a brace group will trigger `errexit` as expected, since the brace group will act as a standalone command with the same exit code.
### Exceptions: ### Exceptions:
ShellCheck will not detect cases where `$?` is implicitly or explicitly used to check the value afterwards: ShellCheck will not detect cases where `$?` is implicitly or explicitly used to check the value afterwards: