How to get full path of a file from another directory in shell script?
<p>I've a shell script at</p>

<pre><code>/home/abc/xyz/test.sh
</code></pre>

<p>I've a file at</p>

<pre><code>/home/def/ghi/jkl/lmn/foo.txt
</code></pre>

<p>I'm running the scrip from /home as I've set my <code>PATH</code> variable to point to <code>/home/abc/xyz/</code></p>

<p>I'm passing the relative path of foo.txt to my script like so <code>test ./def/ghi/jkl/lmn/foo.txt</code></p>

<p>I want to capture the full path of foo.txt into a <strong>variable</strong> in my script, any pointers?</p>

<p>Tried <a href="https://stackoverflow.com/a/5265775">https://stackoverflow.com/a/5265775</a> and <a href="https://stackoverflow.com/a/9107028/4468505">https://stackoverflow.com/a/9107028/4468505</a> but in vain.</p>