Link to home
Start Free TrialLog in
Avatar of Marketing_Insists
Marketing_Insists

asked on

find scripts directory location


If $0 gives the location of the script you are running, how can I just get the directory where the script is located?

CWD; doesn't work the I want, since if I execute a script located on a network drive from the commandline on my local PC, the working directory would be whatever directory I'm in at my shell.


ASKER CERTIFIED SOLUTION
Avatar of GnarOlak
GnarOlak

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Marketing_Insists
Marketing_Insists

ASKER

Yes, that's it exactly, thanks!
I would probably

my @parts = split('\\\\',$0);

pop(@parts);

print join "\\",@parts;
oops too late.