diff --git a/SC2155.md b/SC2155.md index f19caed..b51fa92 100644 --- a/SC2155.md +++ b/SC2155.md @@ -9,8 +9,8 @@ export foo="$(mycmd)" ### Correct code: ```sh -export foo foo=$(mycmd) +export foo ``` ### Rationale: @@ -24,8 +24,8 @@ When first marked for export and assigned separately, the return value of the as If you intend to ignore the return value of an assignment, you can either ignore this warning or use ```sh -export foo foo=$(mycmd) || true +export foo ``` Shellcheck does not warn about `export foo=bar` because `bar` is a literal and not a command substitution with an independent return value. It also does not warn about `local -r foo=$(cmd)`, where declaration and assignment must be in the same command.