Line 5:
q=( "k1" "v1" "k2" "v2")
^-- SC2190 (warning): Elements in associative arrays need index, e.g. array=( [index]=value ) .
^-- SC2190 (warning): Elements in associative arrays need index, e.g. array=( [index]=value ) .
^-- SC2190 (warning): Elements in associative arrays need index, e.g. array=( [index]=value ) .
^-- SC2190 (warning): Elements in associative arrays need index, e.g. array=( [index]=value ) .
Here's what I wanted or expected to see:
Code OK
Bash man page says
When assigning to an associative array, the words in a compound assignment may be either assignment statements, for which the subscript is required, or a list of words that is interpreted as a sequence of alternating keys and values: name=( key1 value1 key2 value2 ...). These are treated identically to name=( [key1]=value1 [key2]=value2 ...). The first word in the list determines how the remaining words are interpreted; all assignments in a list must be of the same type. When using key/value pairs, the keys may not be missing or empty; a final missing value is treated like the empty string.
It means the syntax var=( key val key val ) is valid.
For bugs
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:
Code OK
Bash man page says
It means the syntax var=( key val key val ) is valid.
Please, update the code and the wiki page https://github.com/koalaman/shellcheck/wiki/SC2190
Thank you.
Regards.
Robert.