title: order of expansion between variable expansion and command substitution
body: <p>The bash man says that variable expansion occurs before command substitution. I was seeking of an example that shows it clearly. So i tried this:</p>
  
  <pre><code>root@antec:/# var=1 
  root@antec:/# echo $(var=2; echo $var)
  2
  root@antec:/#
  </code></pre>
  
  <p>I was expecting bash to do:<br />
  1) replace $var by "1" in the substitution<br />
  2) execute echo $(var=2; echo 1)</p>
  
  <p>Obviously this is not what bash is doing ..<br />
  Can someone please explain what is going one here ? And if someone has an example showing the precedence of variable expansion over command substitution it would be nice too</p>