You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Line 2:
python "$PY" "$@" || return $?$(
^-- [SC2046](https://www.shellcheck.net/wiki/SC2046) (warning): Quote this to prevent word splitting.
^-- [SC2327](https://www.shellcheck.net/wiki/SC2327) (warning): This command substitution will be empty because the command's output gets redirected away.
^-- [SC2116](https://www.shellcheck.net/wiki/SC2116) (style): Useless echo? Instead of 'cmd $(echo foo)', just use 'cmd foo'.
Line 3:
echo E: "Python script '$PY' with $# arguments failed, rv=$?" >&2)
>> ^-- [SC2328](https://www.shellcheck.net/wiki/SC2328) (error): This redirection takes output away from the command substitution (use tee to duplicate).
Here's what I wanted or expected to see:
When the command substitution will be empty (SC2327), I expect to not be warned about word-splitting of the empty result (SC2046).
When the reason why the substitution will be empty is that all of it will be redirected away (SC2327), the echo shall not be considered useless (SC2116).
I want an option to disable SC2328 ("This redirection takes output away from the command substitution (use tee to duplicate).") only in cases where the substitution is guaranteed to be empty. Even better if I could further restrict it to being used in a "return" or "exit" instruction.
The text was updated successfully, but these errors were encountered:
This is interesting; I've never seen process substitution used this way, to effectively create a compound statement without affecting $?. Typically, I've done this:
The advantage of my way is that you don't have to pick a name for a temporary variable, and it's shorter overall. Also I'm not sure how portable it is to use local within { … }; if not, you'd have to pre-declare your temporary variable to not pollute a caller's namespace.
For bugs
shellcheck --version
or "online"): onlineFor new checks and feature suggestions
Here's a snippet or screenshot that shows the problem:
Here's what shellcheck currently says:
Here's what I wanted or expected to see:
When the command substitution will be empty (SC2327), I expect to not be warned about word-splitting of the empty result (SC2046).
When the reason why the substitution will be empty is that all of it will be redirected away (SC2327), the echo shall not be considered useless (SC2116).
I want an option to disable SC2328 ("This redirection takes output away from the command substitution (use tee to duplicate).") only in cases where the substitution is guaranteed to be empty. Even better if I could further restrict it to being used in a "return" or "exit" instruction.
The text was updated successfully, but these errors were encountered: