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

Improve SC2016 when argument is concated with single and double quotes #2538

Open
2 tasks done
ap-wtioit opened this issue Jul 19, 2022 · 0 comments
Open
2 tasks done

Comments

@ap-wtioit
Copy link

For new checks and feature suggestions

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

#!/bin/bash
bar="bar"
echo '$foo'"$bar"

Here's what shellcheck currently says:

[Line 3:](javascript:setPosition(3, 6))
echo '$foo'"$bar"
     ^-- [SC2016](https://www.shellcheck.net/wiki/SC2016) (info): Expressions don't expand in single quotes, use double quotes for that.

Here's what I wanted or expected to see:

When i'm using single and double quotes to concat an arg for a command, it's likely i'm aware of the difference between single and double quotes so SC2016 in this case is just anoying and not helping.

A more real life example where i'm actually using something like this:

sed 's,\(set \$variable \).*,\1"'"$new_variable_value"'";' "$file"
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