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
My shellcheck version (shellcheck --version or '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
Here's a snippet or screenshot that shows the problem:
#!/bin/bash
i=4
echo'==' fitInvMass.C+("$i")
Here's what shellcheck currently says:
No issues detected!
Here's what I wanted or expected to see:
When bash executes this script I get this error,
myscript: line 3: syntax error near unexpected token `('
myscript: line 3: `echo '==' fitInvMass.C+("$i")'
The echo '==' is a placeholder for a command that a user was trying to include.
I would expect shellcheck to spot the syntax error, and maybe suggest that the string containing the (…) brackets should be double-quoted. (The original expression was fitInvMass.C+($i) and shellcheck suggested "SC2086 (info): Double quote to prevent globbing and word splitting" for the $i variable.)
The text was updated successfully, but these errors were encountered:
This is likely due to accepting +("$i") as an extended globbing pattern. However, ShellCheck accepts the syntax even though the extglob shell option is not enabled.
I recognize that in the most general case, ShellCheck would likely have to evaluate the given shell code to figure out what shell options are set at any particular part of a script if it wants to find issues like these and that this may be too much to ask. But some form of heuristics could maybe be considered, such as an option not being mentioned anywhere in the code?
For bugs
shellcheck --version
or 'online'): onlineHere'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
bash
executes this script I get this error,The
echo '=='
is a placeholder for a command that a user was trying to include.I would expect shellcheck to spot the syntax error, and maybe suggest that the string containing the
(…)
brackets should be double-quoted. (The original expression wasfitInvMass.C+($i)
and shellcheck suggested "SC2086 (info): Double quote to prevent globbing and word splitting" for the$i
variable.)The text was updated successfully, but these errors were encountered: