How to read entire line from bash
As @Zac noted in the comments, the simplest solution to the question you post is simply cat file.txt
so i must assume there is something more interesting going on so i have put the two options that solve the question as asked as well:
There are two things you can do here, either you can set IFS
(Internal Field Separator) to a newline and use existing code, or you can use the read
or line
command in a while loop
IFS=""
or
(while read line ; do //do something done) < file.txt