koalaman / shellcheck

ShellCheck, a static analysis tool for shell scripts
https://www.shellcheck.net
GNU General Public License v3.0
36.14k stars 1.77k forks source link

printf -v and arrays #433

Open izabera opened 9 years ago

izabera commented 9 years ago

printf doesn't set array variables correctly

printf -v "var[2]" x; echo "${var[2]}"
                            ^-- SC2154: var is referenced but not assigned.
kurahaupo commented 8 years ago

Or rather, printf does set array variables correctly, but shellcheck fails to note that it has done so.