$0 gives different results on Redhat versus Ubuntu?
<p>I have the following script created by some self-claimed bash expert:</p>

<pre><code>SCRIPT_LOCATION="$(readlink -f $0)"
SCRIPT_DIRECTORY="$(dirname ${SCRIPT_LOCATION})"
export PYTHONPATH="${PYTHONPATH}:${SCRIPT_DIRECTORY}/util"
</code></pre>

<p>That runs nicely on my local Ubuntu 16.04. Now I wanted to use it on our RH 7.2 servers; and there I got an error message from <code>readlink</code>; about being called with bad parameters.</p>

<p>Then I figured: on Ubuntu, $0 gives "bash"; whereas on RH, it gives "-bash". </p>

<p>EDIT: script is invoked as <code>. ourscript.sh</code> </p>

<p>Questions: </p>

<ol>
<li>Any idea why that is?</li>
<li>When I change my script to use a hardcoded <code>readlink -f bash</code> the whole things works. Are there "better" ways for fixing this?</li>
<li>Feel free to also explain what readlink -f bash is actually doing ;-)</li>
</ol>