title: In bash, how do I open a writable file descriptor that's externally redirectable?
body: <p>I'm trying to use bash to open a new descriptor for writing extra diagnostic messages. I don't want to use stderr, because stderr should only contain output from the programs called by bash. I also want my custom descriptor to be redirectable by the user.</p>
  
  <p>I tried this:</p>
  
  <pre><code>exec 3&gt;/dev/tty
  echo foo1
  echo foo2 &gt;&amp;2
  echo foo3 &gt;&amp;3
  </code></pre>
  
  <p>But when I try to redirect fd 3, the output still writes to the terminal.</p>
  
  <pre><code>$ ./test.sh &gt;/dev/null 2&gt;/dev/null 3&gt;/dev/null
  foo3
  </code></pre>