title: Redirect debug and STDOUT to different files
body: <p>Is there a way to redirect my debug output to a file and normal STDOUT on screen.</p>
  
  <pre><code>$ cat test1.sh
  #!/bin/bash
  
  echo HAI
  echo BYE
  
  $ sh -x test1.sh
  + echo HAI
  HAI
  + echo BYE
  BYE
  </code></pre>
  
  <p>I want to redirect the debug output to file and normal output on the screen. </p>
  
  <pre><code>$ sh -x test1.sh &gt;file1
  + echo HAI
  + echo BYE
  </code></pre>
  
  <p>But I can redirect the output to a file and ending the debug output on screen.</p>