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
Rule Id (if any, e.g. SC1000): SC2154, SC2034 and SC2209
My shellcheck version (shellcheck --version or "online"):
shellcheck --version
ShellCheck - shell script analysis tool
version: 0.8.0
license: GNU General Public License, version 3
website: https://www.shellcheck.net
Here's a snippet or screenshot that shows the problem:
#!/bin/bashtest_arr()
{
local -n farr=$1
farr[c]=cc
farr[d]=dd
farr[keb]=dd
echo"${farr[*]}"
}
declare -A arr
arr[a]=aa
arr[b]=bb
test_arr arr
Here's what shellcheck currently says:
In associate_array.sh line 6:
farr[c]=cc
^-- SC2154 (warning): c is referenced but not assigned.
In associate_array.sh line 7:
farr[d]=dd
^-----^ SC2209 (warning): Use var=$(command) to assign output (or quote to assign string).
^-- SC2154 (warning): d is referenced but not assigned.
In associate_array.sh line 8:
farr[keb]=dd
^-------^ SC2209 (warning): Use var=$(command) to assign output (or quote to assign string).
^-^ SC2154 (warning): keb is referenced but not assigned.
In associate_array.sh line 16:
arr[ab]=aabb
^-----^ SC2034 (warning): arr appears unused. Verify use (or export if used externally).
For more information:
https://www.shellcheck.net/wiki/SC2034 -- arr appears unused. Verify use (o...
https://www.shellcheck.net/wiki/SC2154 -- c is referenced but not assigned.
https://www.shellcheck.net/wiki/SC2209 -- Use var=$(command) to assign outp...
Here's what I wanted or expected to see:
empty result
The text was updated successfully, but these errors were encountered:
So this code all worked. But shellecheck.net complained:
Line 7:
hash[biz]=3
^-- [SC2034](https://github.com/koalaman/shellcheck/wiki/SC2034) (warning): hash appears unused. Verify use (or export if used externally).
__I think that's wrong; we use it in the unset.__
Line 15:
declare key='bar'
^-- [SC2034](https://github.com/koalaman/shellcheck/wiki/SC2034) (warning): key appears unused. Verify use (or export if used externally).
__That's definitely wrong; we use it in the unset.__
For bugs
shellcheck --version
or "online"):For new checks and feature suggestions
Here's a snippet or screenshot that shows the problem:
Here's what shellcheck currently says:
Here's what I wanted or expected to see:
empty result
The text was updated successfully, but these errors were encountered: