Re: Finding absolute path of a script from within

Re: Finding absolute path of a script from within

am 03.04.2008 20:07:57 von Rajesh Ghosh

On Mar 14, 12:27=A0pm, Jeenu wrote:
> Hi,
>
> I'm wondering what would be the best way to get the absolute path of
> script, within it. 'basename', 'dirname' and 'pwd' =A0don't always give
> the same output, since it depends on where you execute the script
> from. Any thoughts?
>
> Thanks
> Jeenu

Try this ...

my_script_path=3D${PWD}/$(dirname $0)

works fairly well whether you invoke the script from it's base
location or from any other dir.

Good luck