title: Local variable assignment with command substitution behaves unexpectedly
body: <p>I got some troubles when managing dialog output and exit codes. Essentially I'm trying to get a one-line script for getting dialog selection and terminate script function:</p>
  <pre><code>local _ui_envname=$(dialog --stdout --cancel-label &quot;Back&quot; --inputbox 'Enter the new environment name:' 0 0) || { echo &quot;Failed&quot;; exit 1; }
  </code></pre>
  <p>However the above command fails miserably (the <code>{ echo &quot;Failed&quot;; exit 1; }</code> is not executed at all when <code>dialog</code> exit code is 1). The culprit seems to be the <code>local</code> keyword: removing the local variable specifier it starts working as expected.</p>
  <p>What is going on? Am I doomed to use &quot;global&quot; variables?</p>