Some languages use the syntax $array[index]
to access an index of an array, but a shell will interpret this as $array
followed by the unrelated literal string (or glob) [index]
.
Here, curly braces are needed to tell the shell that the square brackets are part of the expansion.
echo "$array[@]"
echo "${array[@]}"
If you want the square brackets to be treated literally or as a glob, use ${var}[idx]
to prevent this warning.
This does not change how the script works, but clarifies your intent to the checker as well as other programmers.