title: bash while loop with command as part of the expression?
body: <p>I am trying to read part of a file and stop and a particular line, using bash.  I am not very familiar with bash, but I've been reading the manual and various references, and I don't understand why something like the following does not work (but instead produces a syntax error):</p>
  
  <pre><code>while { read -u 4 line } &amp;&amp; (test "$line" != "$header_line")
  do
    echo in loop, line=$line
  done
  </code></pre>
  
  <p>I think I could write a loop that tests a "done" variable, and then do my real tests inside the loop and set "done" appropriately, but I am curious as to 1) why the above does not work, and 2) is there some small correction that would make it work?  I still fairly confused about when to use [, (, {, or ((, so perhaps some other combination would work, though I have tried several.</p>
  
  <p>(Note:  The "read -u 4 line" works fine when I call it above the loop.  I have opened a file on file descriptor 4.)</p>