-
Notifications
You must be signed in to change notification settings - Fork 1.9k
SC2190
Simon Brandt edited this page Jun 25, 2025
·
3 revisions
declare -A foo
foo=( myvalue )
declare -A foo
foo=( [key]=myvalue )
You appear to be initializing or appending an array element to an associative array without giving it an index. In an indexed array, elements will be auto-indexed by incremented characters. In associative arrays, the index must be given explicitly.
This could happen because of invalid spaces or otherwise malformed index assignment, such as array=( [key] = value )
. This should instead be array=( [key]=value )
.
ShellCheck may be confused when a variable name is reused in different contexts. If ShellCheck mistakenly believes the array is associative, please ignore this error.