So this snippet of code works just fine, the "$i" is in double quotes:
for ((i=0; i <= 10; i++)); do
printf '%d\n' "$i"
done
However, if I put the "$i" in single quotes ('$i'), i just get 10 iterations of this:
bash: printf: $i: invalid number
0
Why? This question contains a bug report, it's not philosophical like the question everyone is saying it's exactly like. I can't read everything on the internet before determining that it was a "bad question".
"..."
,'...'
,$'...'
, and$"..."
quotes in the shell?" and this similar stackoverflow question. – Gordon Davisson Aug 11 '22 at 01:19