SPUG: finding full path to itself

Chris Wilkes cwilkes-spug at ladro.com
Tue May 30 21:12:42 PDT 2006

On Tue, May 30, 2006 at 02:36:20PM -0700, Satish Gupta wrote:
> When I a stand-alone script is running, how can this script determine
> it's own absolute path in a portable manner?
> I notice that $0 works differently on different OS's. On some it gives
> full path and not on others.

Along those same lines how can I, in a portable manner, determine the
full path to the perl executable?

Kwiki has a hardcoded path of #!/usr/bin/perl which is okay for most
non-windows machines, but I'm stuck with a windows box for right now.  It
is not a big deal as I just edit index.cgi after every update (or I
could edit the Kwiki::Files file) but it would be nice to automagically
figure that out when installing Kwiki.


More information about the spug-list mailing list