title: Unable to execute a script from another shell script
body: <p>I have a script (<code>A</code>) which begins with a <code>#!/bin/sh</code> shebang.</p>
  
  <p>There is another file (<code>B</code>) which doesn't begin with <code>#!/bin/sh</code>; it has some environment variables which I need to set for <code>A</code> to work.</p>
  
  <p>The file <code>B</code> runs fine, and sets the variables when executed from <code>.bash_profile</code>.  For example, in my <code>.bash_profile</code> file:</p>
  
  <pre><code>{. /(full_path)/(envname)/(filename).sh;}
  </code></pre>
  
  <p>When I write same line in my <code>A</code> script file, nothing happens.  Why not?</p>
  
  <p>I did <code>echo $env_variable_name</code>; this gives me the correct path when executed via <code>.bash_profile</code> but gives me blank when via my script <code>A</code>. I tried</p>
  
  <ul>
  <li><pre><code>/(full_path)/(envname)/(filename).sh
  </code></pre></li>
  <li><pre><code>SCRIPT_FULL_NAME=$(readlink -f "$0")
  SCRIPT_PATH=$(dirname $SCRIPT_FULL_NAME)
  sh ${SCRIPT_PATH}/(filename).sh
  </code></pre></li>
  </ul>
  
  <p>What should I do?</p>