From 42e6cdbc6d118d3df2b0fa76238fa7e1910f7afa Mon Sep 17 00:00:00 2001 From: fent Date: Wed, 16 Oct 2019 12:40:04 -0400 Subject: [PATCH] missing the `!` in example, see https://github.com/koalaman/shellcheck/issues/782 --- SC2181.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SC2181.md b/SC2181.md index 9191825..85de623 100644 --- a/SC2181.md +++ b/SC2181.md @@ -35,7 +35,7 @@ To check that a command returns success, use `if mycommand; then ...`. To check that a command returns failure, use `if ! mycommand; then ...`. Notice that `!` will overwrite `$?` value. -To additionally capture output with command substitution: `if output=$(mycommand); then ...` +To additionally capture output with command substitution: `if ! output=$(mycommand); then ...` This also applies to `while`/`until` loops.