There are two ways of reading a file line by line that I want to discuss here:
#!/bin/bash
while read line
do
echo-e "$ line \ n"
done <file.txt
and
#!/bin/bash
exec 3<file.txt
while read line
do
echo-e "$ line \ n"
done
So first version works fine but I don't understand the mechanism of working while loop with the file. But the mechanism of the second version I understand. But here I don't understand why it hangs and does not print anything.