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
Here's a snippet or screenshot that shows the problem:
The error codes presented are directly from shellcheck.net
The following shows the inappropriate use (as described above) of the SC1083 message to improve a prior SC1009 message.
#!/bin/bash
b[1]='2'
a="$(b[c]}"echo "a=${a}"
The results for the above follow: (the solution is to replace the leading ( with a { not any of the suggested solutions)
$ shellcheck myscript
[Line 4:](javascript:setPosition(4, 6))
a="$(b[c]}"
^-- [SC1009](https://www.shellcheck.net/wiki/SC1009) (info): The mentioned syntax error was in this simple command.
^-- [SC1083](https://www.shellcheck.net/wiki/SC1083) (warning): This } is literal. Check expression (missing ;/\n?) or quote it.
[Line 6:](javascript:setPosition(6, 13))
echo "a=${a}"
^-- [SC1073](https://www.shellcheck.net/wiki/SC1073) (error): Couldn't parse this double quoted string. Fix to allow more checks.
[Line 7:](javascript:setPosition(7, 1))
^-- [SC1072](https://www.shellcheck.net/wiki/SC1072) (error): Expected end of double quoted string. Fix any mentioned problems and try again.
$
flipping the { ... ) changes the results as follows
#!/bin/bash
b[1]='2'
a="${b[c])"echo "a=${a}"
results follow: The SC1009 message appears be be correct but very vague. The additional errors on the echo statement would appear to be completely bogus. Indicating solving the first error seems to be a priority considering that subsequent errors may not be errors at all.
$ shellcheck myscript
[Line 4:](javascript:setPosition(4, 4))
a="${b[c])"
^-- [SC1009](https://www.shellcheck.net/wiki/SC1009) (info): The mentioned syntax error was in this parameter expansion.
[Line 6:](javascript:setPosition(6, 13))
echo "a=${a}"
^-- [SC1073](https://www.shellcheck.net/wiki/SC1073) (error): Couldn't parse this double quoted string. Fix to allow more checks.
^-- [SC1072](https://www.shellcheck.net/wiki/SC1072) (error): Expected end of double quoted string. Fix any mentioned problems and try again.
$
Here's what shellcheck currently says:
see above following each example
Here's what I wanted or expected to see:
In both cases identification of the mismatched ( ... } or { ... ) would point directly to the probable error. Leaving it to the user to determine if "$( ... }" is a command that should end in ')"' or a variable reference (this case) that should start with '"${'.
Ideally the enclosing double quotes in "$? ... ?" would prevent the error identification in the echo statement in the second case where a="${b[c])" was coded.
Thanks.
The text was updated successfully, but these errors were encountered:
dshuman52
changed the title
test beginning with "${ and "$(" generate inconsistent (and at times confusing) sc1009 and for "$( an inconsistent and potentially incorrect sc1083 messages.
test beginning with "${ and "$(" generate inconsistent (and at times confusing) sc1009 and for "$( an inconsistent and potentially incorrect sc1083 message.
Nov 26, 2024
dshuman52
changed the title
test beginning with "${ and "$(" generate inconsistent (and at times confusing) sc1009 and for "$( an inconsistent and potentially incorrect sc1083 message.
test beginning with "${ and "$(" generate an at times confusing sc1009 and for "$( an inconsistent and potentially incorrect sc1083 message.
Nov 26, 2024
dshuman52
changed the title
test beginning with "${ and "$(" generate an at times confusing sc1009 and for "$( an inconsistent and potentially incorrect sc1083 message.
test beginning with "${ and "$(" generate an at times confusing sc1009 and for "$( a potentially incorrect sc1083 message.
Nov 26, 2024
For bugs
This is a close relative of issue #3085 however I believe an entirely different issue.
For new checks and feature suggestions
Here's a snippet or screenshot that shows the problem:
The error codes presented are directly from shellcheck.net
The following shows the inappropriate use (as described above) of the SC1083 message to improve a prior SC1009 message.
The results for the above follow: (the solution is to replace the leading ( with a { not any of the suggested solutions)
flipping the { ... ) changes the results as follows
results follow: The SC1009 message appears be be correct but very vague. The additional errors on the echo statement would appear to be completely bogus. Indicating solving the first error seems to be a priority considering that subsequent errors may not be errors at all.
Here's what shellcheck currently says:
see above following each example
Here's what I wanted or expected to see:
In both cases identification of the mismatched ( ... } or { ... ) would point directly to the probable error. Leaving it to the user to determine if "$( ... }" is a command that should end in ')"' or a variable reference (this case) that should start with '"${'.
Ideally the enclosing double quotes in "$? ... ?" would prevent the error identification in the echo statement in the second case where a="${b[c])" was coded.
Thanks.
The text was updated successfully, but these errors were encountered: