title: While loop command and stdout processing
body: <p>I have a Bash function, <code>foo()</code>, which will return 0 or 1 always. When it is returning 0, it would have produced some stdout:</p>
  
  <pre><code>foo() {
      if ...
        echo "aaa\nbbb"
        return 0
      else
        return 1
      fi
  }
  </code></pre>
  
  <p>I want to repeatedly call this <code>foo</code> function, process its stdout, until it returns non-zero:</p>
  
  <pre><code>while foo; do
    # process foo's stdout that that one execution
  done
  </code></pre>
  
  <p>But I don't know how to cleanly store the stdout of <code>foo</code> and use it in the while expression at the same time.</p>
  
  <p>In ruby I might have done something like:</p>
  
  <pre><code>while text = self.foo do
    ...
  end
  </code></pre>
  
  <p>Any suggestions? TIA</p>