shellcheck
shellcheck copied to clipboard
SC2086: Numeric expansion
For bugs
- Rule Id:
SC2086 - My shellcheck version:
0.9.0 - [x] The rule's wiki page does not already cover this at Wiki
- [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:
#!/bin/sh
a=hey
b=${#a}
echo $b ${#a}
Here's what shellcheck currently says:
Line 4:
echo $b ${#a}
^-- SC2086 (info): Double quote to prevent globbing and word splitting.
Here's what I wanted or expected to see:
Nothing. Expansion is always numeric length.
This rule should behave same like int constant assignment.
b=3
b=${#a}