set -g hi "lol lol 123 321"
For I in $hi
echo $hi
end
It directly output $hi
You have numerous issues here:
Let's replace $hi with its value here:
for I in "lol lol 123 321"
echo "lol lol 123 321"
end
See how that might print lol lol 123 321
once? Fish does not do word-splitting, so if you set $hi to "lol lol 123 321"
, that's the value that will be used when you use the variable without quotes. So it's like we've just done here.
There is no way fish can't "use this variable as value in for grammar". It uses the variable as you told it.
What I think you meant was
set -g hi lol lol 123 321
for I in $hi
echo $I
end
which will print
lol
lol
123
321
See how this sets $hi without quotes, so it's now four separate elements? Also it uses the actual loop variable in the loop.