I am having trouble using a Here Document variable in a loop. Because this works
while IFS= read -r line; do
echo "(${line})"
done <<EOF
one
two
three
EOF
But this doesn't
foo=<<EOF
one
two
three
EOF
while IFS= read -r line; do
echo "(${line})"
done <<<"$foo"
Now I am a bit of a noob in bash scripting. Besides having question marks above my head I wonder how I can preserve the second syntax (the here document at the top of my script) and still make it work somehow.
Thanks for your help.