Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggested improvement for SC2006's "Did you mean" alternative message #2949

Open
2 tasks done
raforg opened this issue Mar 20, 2024 · 0 comments
Open
2 tasks done

Suggested improvement for SC2006's "Did you mean" alternative message #2949

raforg opened this issue Mar 20, 2024 · 0 comments

Comments

@raforg
Copy link

raforg commented Mar 20, 2024

Hi, the current Did-you-mean? alternative for SC2006 "Use $(...) notation instead of legacy backticks would be much improved if it removed the would-no-longer-be-necessary backslash quoting that is necessary when using backticks, but is not necessary when using $(...). See the example below.

For bugs

Here's a snippet or screenshot that shows the problem:

#!/bin/sh
target="`readlink \"$symlink\"`"

Here's what shellcheck currently says:

Line 1296:
            target="`readlink \"$symlink\"`"
                    ^-- SC2006 (style): Use $(...) notation instead of legacy backticks `...`.

Did you mean: (apply this, apply all SC2006)
            target="$(readlink \"$symlink\")"

Here's what I wanted or expected to see:

Line 1296:
            target="`readlink \"$symlink\"`"
                    ^-- SC2006 (style): Use $(...) notation instead of legacy backticks `...`.

Did you mean: (apply this, apply all SC2006)
            target="$(readlink "$symlink")"

Note: The difference is the absence of the backslash characters that precede doublequotes in the original. These backslashes would no longer be necessary if backticks were to be replaced with $(...). Making this clear would further encourage making the siggested change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant