title: Bash script to exit when any command (including non-simple commands) fail
body: <p>I have a script </p>
  
  <pre><code>#! /bin/sh
  set -eux
  
  command_a
  
  command_b | command_c
  
  while [ true ]; do
      command_d
  done
  </code></pre>
  
  <p>I'd like this to fail when any command fails. If <code>command_a</code> fails, the script fails, but if <code>command_b</code> or <code>command_d</code> (not sure about <code>command_c</code>) fail, the script carries on.</p>