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:
#!/usr/bin/bash
x=(foo bar [1]+=quux)
echo"${x[@]}"
Here's what shellcheck currently says:
In - line 3:
x=(foo bar [1]+=quux)
^---^ SC2191 (warning): The = here is literal. To assign by index, use ( [index]=value ) with no spaces. To keep as literal, quote it.
Did you mean:
x=(foo bar [1]+"=quux")
For more information:
https://www.shellcheck.net/wiki/SC2191 -- The = here is literal. To assign ...
Here's what I wanted or expected to see:
This shouldn't trigger SC2191.
Note: Only the += operator works in this context, even with typeset -i; ++ and -= trigger syntax errors in Bash, whereas --, *= and /= get interpreted as literals.
The text was updated successfully, but these errors were encountered:
For bugs
shellcheck --version
or "online"): 0.10.0Here's a snippet or screenshot that shows the problem:
Here's what shellcheck currently says:
Here's what I wanted or expected to see:
This shouldn't trigger SC2191.
Note: Only the
+=
operator works in this context, even withtypeset -i
;++
and-=
trigger syntax errors in Bash, whereas--
,*=
and/=
get interpreted as literals.The text was updated successfully, but these errors were encountered: