title: bash: debug option and functions
body: <p>If I run </p>
  
  <pre><code>bash -x myscript.sh
  </code></pre>
  
  <p>I'll get debugging output.</p>
  
  <p>But if I have a function in <code>myscript.sh</code>, the code in the function is immune to -x option. It writes to output only the name of the function.</p>
  
  <p>How to obtain debugging output for functions in bash scripts?</p>
  
  <p><strong>Update:</strong></p>
  
  <p>Following the ztank1013's response, I just realized that I used ksh, not bash. Seems bash has by default the functrace option enabled in my system(thanks bash-o-logist)</p>
  
  <p>I am satisfied, but for the community I maintain the question open for ksh. </p>
  
  <p>For script:</p>
  
  <pre><code>#!/bin/ksh
  
  a=2
  testering(){
          a=3
          if [ $a -eq 3 ]; then
                  echo lili
          fi
  }
  if [ $a -eq 2 ]; then
          echo mimi
  fi
  
  testering
  exit
  </code></pre>
  
  <p>output of <code>ksh -x ./testdebug.sh</code> is:</p>
  
  <pre><code>+ a=2
  + [ 2 -eq 2 ]
  + echo mimi
  mimi
  + testering
  lili
  + exit
  </code></pre>
  
  <p>So, for ksh, what's the trick?</p>
  
  <p>(If no answer will come, the 'correct' will go to bash-o-logist.)</p>