Closed gstory20 closed 2 months ago
Forgot to include: I saw this in version 0.7.1 and verified it in the current online version.
I would probably use a heredoc for that type of string.
The inside of the subshell $(...)
will need proper quoting as shellcheck has pointed out.
If you had used single quotes for the string the subshell would not execute but I think you wanted the variable $HOME to be expanded and thus that would have crippled that part.
Maybe it can be constructed safe with printf. I would opt to add the quotes in the subshell execution at least.
In some quarters, there's a common refrain: QEFE: "Quote Every F@#$_&-
Expansion." That would apply in most cases, unless you're intending to make
use of Word Splitting, using a pattern or regexp on the right hand side of
a [[
keyword, for style reasons, on variables known to be integers, on
the RHS of a foo=$(echo "$bar")
-style parameter assignment, and probably
a few other places that escape me at the moment. More frequent use of
quotes tends to cause fewer errors than less frequent, basically.
Wiley
On Sun, Sep 1, 2024, 11:42 PM brother @.***> wrote:
I would probably use a heredoc for that type of string.
The inside of the subshell $(...) will need proper quoting as shellcheck has pointed out. If you had used single quotes for the string the subshell would not execute but I think you wanted the variable @HOME to be expanded and thus that would have criippled that part. Maybe it can be constructed safe with printf. I would opt to add the quotes in the subshell execution at least.
— Reply to this email directly, view it on GitHub https://github.com/koalaman/shellcheck/issues/3049#issuecomment-2323931157, or unsubscribe https://github.com/notifications/unsubscribe-auth/AUF2F22MP63777CCOEUC2BLZUQCD5AVCNFSM6AAAAABNO5TCW2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMRTHEZTCMJVG4 . You are receiving this because you are subscribed to this thread.Message ID: @.***>
For bugs
shellcheck --version
or "online"):For 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:
<no output: The line in question is already in (multi-line) double quotes.>