Finding end of file



I would like to know how can we find the end of file when reading from
a file using shell script.

Basically, I want to read 2 lines using a while loop till it reaches
the end of a file. Here is how I am reading 2 lines from the
result-data file inside a while loop.

do
{
read line1
read line2
} < result-data
done

Can anyone let me know how can I check for the end of file from a shell
script.

Thanks,
Sekar

.



Relevant Pages

  • Re: Problem with a script
    ... a loop there becomes impractical. ... You still have them as uniquely named array indexes... ... writing the code twice will only ... reading your entire code and parsing it in their head, ...
    (comp.lang.php)
  • Re: Problem with a script
    ... Okay, so variables have unique labels, that doesn't mean they still couldn't be handled in a loop. ... You still have them as uniquely named array indexes... ... I believe that for the new guy this code would be readable, and identifying problems should really not be any more difficult with this, plus I think that it actually might save some time to write the actual code from the beginnig, even though it's not at it's final stage, instead of first writing everything spread out, and then rewriting the same code again cleaned. ... If you expect a person to spend an hour reading your entire code and parsing it in their head, you wont get any help and have to solve the problem by yourself. ...
    (comp.lang.php)
  • Re: advice and/or help on glReadPixels
    ... I could not see any "BRGA" in the documentation. ... Is it possible that some cards are not ... >>> a) Try reading the entire RGB instead of just the red. ... a quick integer loop with a mask & shift is ...
    (comp.graphics.api.opengl)
  • RE: 2.6.28-rc6-mmotm1126 - acpi AE_AM_INFINITE_LOOP errors..
    ... You could try making the max loop count larger, ... This is a Dell Latitude D820, and didn't seem to have any infinite AML ... reading AC Adapter state ...
    (Linux-Kernel)
  • Re: while (1) vs. for ( ;; )
    ... >to write to the next guy who will be reading the code. ... You are unfamiliar with the term "infinite loop"? ... Balmer Consulting ...
    (comp.lang.c)