shellcheck
shellcheck copied to clipboard
SC2145 incorrectly errors on string and array concatenated seperately but wtihoout space.
For bugs
- Rule Id (if any, e.g. SC1000): SC2145
- My shellcheck version (
shellcheck --versionor "online"): 0.6.0 (and online) - [x] The rule's wiki page does not already cover this (e.g. https://shellcheck.net/wiki/SC2086)
- [x] I tried on shellcheck.net and verified that this is still a problem on the latest commit
Here's a snippet or screenshot that shows the problem:

#!/usr/bin/env bash
tagApiPaths=(
blah
blah
blah
)
echo "DEBUG" $'tagApiPaths \n'"${tagApiPaths[@]}"
adding a space like so:
#!/usr/bin/env bash
tagApiPaths=(
blah
blah
blah
)
echo "DEBUG" $'tagApiPaths \n' "${tagApiPaths[@]}"
makes the error message go away but it adds an undesirable space in front of the first entry of the array.
Here's what shellcheck currently says:
Argument mixes string and array. Use * or separate argument. [SC2145]
Here's what I wanted or expected to see:
Nothing, there is nothing wrong with the line.
Sigh.... just doing what it says makes my issue go away ofcourse. Closing issue.
i.e. echo "DEBUG" $'tagApiPaths \n'"${tagApiPaths[*]}" does what I want...