title: Read first three lines of a file in bash
body: <p>I have the following shell script to read in the first three lines of file and print them out to screen - it is not working correctly as it prints out lines 2,3,4 instead of lines 1,2,3 - What am I doing wrong ?</p>
  
  <pre><code>exec 6&lt; rhyme.txt
  
  while read file &lt;&amp;6 ;
  do
          read line1 &lt;&amp;6
          read line2 &lt;&amp;6
          read line3 &lt;&amp;6
  
          echo $line1 
          echo $line2 
          echo $line3 
  done
  
  exec 6&lt;&amp;-
  </code></pre>
  
  <p>Thanks for your answers - I'm am aware of head command but want to use read and file descriptors to display the first three lines </p>