title: Unix shell scripting: pass shell options (-x etc.) to nested scripts
body: <p>How can I run nested shell scripts with the same option?  For example,</p>
  
  <p><code>parent.sh</code></p>
  
  <pre><code>#!/bin/sh
  ./child.sh
  </code></pre>
  
  <p><code>child.sh</code></p>
  
  <pre><code>#!/bin/sh
  ls
  </code></pre>
  
  <p>How can I modify <code>parent.sh</code> so that when I run it with <code>sh -x parent.sh</code>, the <code>-x</code> option is effective in <code>child.sh</code> as well and the execution of <code>ls</code> is displayed on my console?</p>
  
  <p>I'm looking for a portable solution which is effective for rare situations such as system users with <code>/bin/false</code> as their registered shell.  Will the <code>$SHELL</code> environment variable be of any help?</p>
  
  <p>Clarification: I sometimes want to call <code>parent.sh</code> with <code>-x</code>, sometimes with <code>-e</code>, depending on the situation.  So the solution must not involve hard-coding the flags.</p>