title: Why does bash not stop on error for failures in sequence of short-circuited commands?
body: <p>I'm seeing some behavior that doesn't make sense to me when I run a bash script with the <code>-e</code> option that has multiple commands strung together with <code>&amp;&amp;</code>s and one of them fails. I would expect the script to stop on the failed command and return the exit status, but instead it just executes the rest of the script happily.</p>
  
  <p>Here are examples that make sense to me:</p>
  
  <pre><code>$ false &amp;&amp; true; echo $?
  1
  
  $ bash -xe -c "false &amp;&amp; true"; echo $?
  + false
  1
  
  $ bash -xe -c "false; true"; echo $?
  + false
  1
  </code></pre>
  
  <p>And here is the one that does not make sense to me:</p>
  
  <pre><code>$ bash -xe -c "false &amp;&amp; true; true"; echo $?
  + false
  + true
  0
  </code></pre>
  
  <p>This is where I don't understand what is going on. <code>false &amp;&amp; true</code> returns status 1 so shouldn't the script stop executing and return status 1, like it does when the script is <code>false; true</code>?</p>
  
  <p>While experimenting, I found that it works the way I would expect if I surround the chain of commands with parentheses:</p>
  
  <pre><code>$ bash -xe -c "(false &amp;&amp; true); true"; echo $?
  + false
  1
  </code></pre>
  
  <p>Can anybody give an explanation for this?</p>