title: bash: append newline when redirecting file
body: <p>Here is how I read a file row by row:</p>
  
  <pre><code>while read ROW
  do
  ...
  done &lt; file
  </code></pre>
  
  <p>I don't use the other syntax</p>
  
  <pre><code>cat file | while read ROW
  do
  ...
  done
  </code></pre>
  
  <p>because the pipe creates a subshell and makes me lose the environment variables.
  The problem arises if the file doesn't end with a newline: last line is not read. It is easy to solve this in the latter syntax, by echoing just a newline:</p>
  
  <pre><code>(cat file; echo) | while read ROW
  do
  ...
  done
  </code></pre>
  
  <p>How do I do the same in the former syntax, without opening a subshell nor creating a temporary file (the list is quite big)?</p>