On Tue, Mar 29, 2011 at 08:02:17AM -0400, Steven W. Orr wrote:
> Is there a difference between
> 
> while read line < file
> do
>     stuff
> done
> 
> vs
> 
> while read line
> do
>     stuff
> done < file

Yes.  It's a huge difference.  In the first one, the file is re-opened
by read every time through the loop, meaning you will keep reading the
first line of it over and over.  In the second one, the file is opened
once, and the read command gets the first line, then the second line, etc.

Reply via email to