title: Pipes with while loops within Parentheses
body: <p>I am going to ask about a structure about <strong>pipes with while loops within parentheses</strong>.</p>
  
  <p>Imagine I have a script like this:</p>
  
  <pre><code>#!/bin/bash
  
  &lt;FirstCommand&gt; | (while read var1; do out=`echo $var1 | &lt;command&gt;` \
                    &lt;sth with $out&gt; done; awk -v RS="" '{print $5,$18,$20}' OtherFile |  awk 'NF==3{print}{}' | awk '{gsub (/&lt;blank&gt;/,""); print}' &gt; file.txt \
                    while read var2 var3 var4; do &lt;sth&gt; done &lt; file.txt)
  </code></pre>
  
  <p>The point is my script is working correctly till end of first <strong>while</strong> loop. but the second one has a problem.</p>
  
  <p>My question:</p>
  
  <p>Is the output of my <code>FirstCommand</code> redirecting to both while loops simultaneously?</p>
  
  <p>About <code>FirstCommand</code>:</p>
  
  <p>This is a command that generates some texts and I want to redirect the output of that to while loops run time.</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>The output of  is appending to <code>OtheFile</code> that <code>awk</code> is using.</p>
  
  <p>Thank you</p>