shellcheck
shellcheck copied to clipboard
SC2154 false positive
For bugs with existing features
- Rule Id: SC2154
- My shellcheck version: 0.11.0
- [x] The rule's wiki page does not already cover this
- [x] I tried on https://www.shellcheck.net/ and verified that this is still a problem on the latest commit
Here's a snippet or screenshot that shows the problem:
#!/bin/bash
declare -a "a=($2)"
options+=("${a[@]}")
Here's what shellcheck currently says:
Line 3:
options+=("${a[@]}")
^-- SC2154 (warning): a is referenced but not assigned.
Here's what I wanted or expected to see:
This worked fine with 0.10.0. The warning is gone if the second line is changed to declare -a a="($2)".