Re: Finding absolute path of a script from within
am 03.04.2008 20:30:27 von Rajesh GhoshOn Apr 3, 11:07=A0pm, Rajesh Ghosh
> On Mar 14, 12:27=A0pm, Jeenu
>
> > 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
Sorry a small correction. Use this instead:
script_home=3D`dirname $0`
script_home=3D"${PWD}/${script_home}"