title: Run a script in the same directory as the current script
body: <p>I have two Bash scripts in the same folder (saved somewhere by the user who downloads the entire repository):</p>
  
  <ul>
  <li><code>script.sh</code> is run by the user</li>
  <li><code>helper.sh</code> is required and run by <code>script.sh</code></li>
  </ul>
  
  <p>The two scripts should be in the same directory. I need the first script to call the second one, but there are two problems:</p>
  
  <ol>
  <li>Knowing the current working directory is useless to me, because I don't know how the user is executing the first script (could be with <code>/usr/bin/script.sh</code>, with <code>./script.sh</code>, or it could be with <code>../Downloads/repo/scr/script.sh</code>)</li>
  <li>The script <code>script.sh</code> will be changing to a different directory before calling <code>helper.sh</code>.</li>
  </ol>
  
  <p>I can definitely hack together Bash that does this by storing <a href="https://stackoverflow.com/a/246128/617937">the current directory</a> in a variable, but that code seems needlessly complicated for what I imagine is a very common and simple task.</p>
  
  <p>Is there a standard way to <em>reliably</em> call <code>helper.sh</code> from within <code>script.sh</code>? And will work in any Bash-supported operating system?</p>