-
Notifications
You must be signed in to change notification settings - Fork 1.8k
SC1087
Vidar Holen edited this page Jan 21, 2015
·
6 revisions
echo "$array[@]"
echo "${array[@]}"
For compatibility reasons, $foo[bar]
is interpreted as the variable $foo
followed by the literal string [bar]
.
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, you can use ${var}[idx]
to prevent this warning.