Not sure if I used the right words in the title, I am trying to do this:
while read line; do echo "$line" exit; done; <( echo "foo\n"; exit )
but it hangs, I don't think the
while loop is getting any input from the
echo process. Does anyone know the right way to do this and why this is wrong?
I could do this:
echo "foo" | while read line; do echo "$line"; done;
but I am looking to do it the first way just for learning purposes. I am not sure if I need process substitution or not.