Docker

Docker

Made by DeepSource

Consider using braces for expanding an array DOK-SC1087

Anti-pattern
Major

Some languages use the syntax $array[index] to access index of an array, but a shell will interpret this as $array followed by the unrelated literal string (or glob) [index].

Curly braces are needed to tell the shell that the square brackets are part of the expansion.

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 and clarifies the intent to other programmers.

Bad Practice

echo "$array[@]"

Recommended

echo "${array[@]}"