title: First command in a bash pipe runs is able to modify parent process variable? Why?
body: <ul>
  <li><p>I am using bash version 4.3.4</p>
  </li>
  <li><p>I know that generally, builtin commands should not get forked ( The shell executes the command directly, without invoking another program.)</p>
  </li>
  </ul>
  <p>While randomly playing with pipes I saw the following thing that I  do not understand:</p>
  <p>a) If I set a shell variable as: a=1 and then run:  a=2 | a=3; echo $a | echo $a --&gt; I will get a=1 (nothing modified)</p>
  <p>b) While a=1 as nothing was modified with the previously command, I then try to run: a=2; echo $a | a=3; echo $a | echo $a that will give me a=2 in the echo reply on the stoud and even in a normal &quot;echo $a&quot; after.</p>
  <p>I can try to put &quot;a=x&quot; with another value for a in any other place in the pipe, like in &quot;a)&quot;, but variable &quot;a&quot; will remain unchanged.
  Why that &quot;echo $a&quot; in the first portion of the pipe modified the &quot;a&quot; variable in the parent shell?</p>