title: Why ksh disables stderr when subshell is executed?
body: <p>The program:</p>
  
  <pre><code>function import {
          set -x
  #        read NAME &lt; &lt;(/usr/bin/pwd)
          NAME=$(/usr/bin/pwd)
          echo 123 &gt;&amp;2
          set +x
  }
  
  echo aaaaaaaaaaa
  import
  echo bbbbbbbbbbb
  OUT=$( import 2&gt;&amp;1 )
  echo "$OUT"
  echo ccccccccccc
  </code></pre>
  
  <p>I hoped to have the output between 'aaa' and 'bbb' to be the same as in between 'bbb' and 'ccc'. But it is not the case with ksh:</p>
  
  <pre><code>aaaaaaaaaaa
  + /usr/bin/pwd
  + NAME=/home/neuron
  + echo 123
  + 1&gt;&amp; 2
  123
  bbbbbbbbbbb
  + /usr/bin/pwd
  ccccccccccc
  </code></pre>
  
  <p>If I change $( ... ) into &lt; &lt;(...), stderr works as usual and I have the same output. I tried that on solaris and linux and it behaves the same, so I guess it's not ksh bug. Please note that it's not just 'set -x' being disabled, also the 'echo 123 1>&amp;2' output disapears. In bash the code works as I would suppose.</p>
  
  <p>My questions are 'why' and 'how to capture the function's stdout and stderr?'</p>
  
  <h2>Thank you</h2>
  
  <p>Vlad</p>