title: trap in exported function silently ignored
body: <p>This Bash script behaves as expected.</p>
  
  <p><strong>test_this.sh</strong></p>
  
  <pre><code>function run_this() {
      trap "echo TRAPPED" EXIT
      false
      echo $?
  }
  run_this
  </code></pre>
  
  <p>It prints</p>
  
  <pre><code>1
  TRAPPED
  </code></pre>
  
  <p>However, when I try to export this function, it fails to trap.</p>
  
  <p><strong>test_this2.sh</strong></p>
  
  <pre><code>function run_this() {
      trap "echo TRAPPED" EXIT
      false
      echo $?
  }
  export -f run_this
  </code></pre>
  
  <p>Source this at the command line and run it:</p>
  
  <pre><code>&gt; source test_this2.sh
  &gt; run_this
  </code></pre>
  
  <p>Results in</p>
  
  <pre><code>1
  </code></pre>
  
  <p>Where did the trap go?</p>