title: How best to include other scripts?
body: <p>The way you would normally include a script is with "source"</p>
  
  <p>eg:</p>
  
  <p>main.sh:</p>
  
  <pre><code>#!/bin/bash
  
  source incl.sh
  
  echo "The main script"
  </code></pre>
  
  <p>incl.sh:</p>
  
  <pre><code>echo "The included script"
  </code></pre>
  
  <p>The output of executing "./main.sh" is:</p>
  
  <pre><code>The included script
  The main script
  </code></pre>
  
  <p>... Now, if you attempt to execute that shell script from another location, it can't find the include unless it's in your path.</p>
  
  <p>What's a good way to ensure that your script can find the include script, especially if for instance, the script needs to be portable?</p>