SPUG: finding directory of script
Daryn Nakhuda
daryn at marinated.org
Thu Feb 14 20:12:05 CST 2002
Is there a best way to get the directory containing the script
you're running? or a way to use relative paths from that
directory to read files?
1. pwd,cwd both return the directory you're running the script from
(working directory), not where it lives.
2. using ./ or ../ is going to be relative to the working dir, not the
script's dir
3. $0 could be used, but you'd have to parse for a ./ or no /, and in
those cases use the working dir.
I don't mind using #3, that would always work, right?
-daryn
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
POST TO: spug-list at pm.org PROBLEMS: owner-spug-list at pm.org
Subscriptions; Email to majordomo at pm.org: ACTION LIST EMAIL
Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address
For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest
Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org
More information about the spug-list
mailing list