-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Open
Description
For bugs
- Rule Id (if any, e.g. SC1000): SC2041
- My shellcheck version (
shellcheck --versionor 'online'): online - I tried on shellcheck.net and verified that this is still a problem on the latest commit
- It's not reproducible on shellcheck.net, but I think that's because it's an OS, configuration or encoding issue
For new checks and feature suggestions
- shellcheck.net (i.e. the latest commit) currently gives no useful warnings about this
- I searched through https://github.com/koalaman/shellcheck/issues and didn't find anything related
Here's a snippet or screenshot that shows the problem:
#!/usr/bin/env bash
for dev in '/dev/disk/by-uuid/28DD-A89E'; do
echo "$dev"
doneHere's what shellcheck currently says:
Line 3 SC2041: This is a literal string. To run as a command, use $(..) instead of '..' .
Here's what I wanted or expected to see:
I would not expect this to warn about SC2041, but SC2043. The following snippet where a second single-quoted element is iterated over does not warn about SC2041 (and, correctly, not about SC2043):
#!/usr/bin/env bash
for dev in '/dev/disk/by-uuid/28DD-A89E' 'foo'; do
echo "$dev"
doneand neither does the following with double quotes (it does warn about SC2043, as expected):
#!/usr/bin/env bash
for dev in "double-quoted"; do
echo "$dev"
doneReactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels