program knowing current directory (perl)?
hey, i am writing this crappy little script that will just create an html file from the contents of the directory i am in. right now the script just uses CWD but i have to copy and paste it into each directoyr i want to do this on, which is a pain in the butt. so i would like to be able to make this program "global" (put it in the usr bin) and somehow have it know what direcotory i am in. is there any way for this to happen?
|
Wait a minute--do you want it to know the home directory or the current directory?
The topic says "home", the message says "current". |
.
|
my bad. i want the program to be global. but i want it to konw what folder i am in. so say i am in /home/user/public_html/bla. i want to call the program, and it will create an index.html file in public_html/bla with the files in that folder. so, the topic should say current, and i will change that. thanks.
|
In that case, Fascistchicken explained it very clearly and simply.
Although that may simply be a shell construct (I don't know) in which case it wouldn't work anywhere else. |
uhm, it may just be me but fascistchickens post is empty?
|
Just look at the value of "$ENV{'PWD'}"
|
Quote:
|
|
even though this is of little importance, I see what sk8guitar sees ;-)
|
I see it too.
Look closely and you will see it as well. ... ;) . very subtle fascistchicken. |
hahaha if he means the ./ to say that its in the current directory, i don't know if that will work becuase the script is in one directory and i am in another. and i tried in the shell to do $ENV{'PWD'} and it didn't know what i was talking about? am i typing this in wrong?
|
Quote:
In the title you said perl ./ will work since it is teh directory YOU are in but it will not give you the full path - hence why I suggested the environment variable. |
Quote:
|
yeah, but i tired the einvroment variable like you said it doesn't seem to be working.
Code:
[akropp@akropp akropp]$ $ENV{'PWD'} |
All times are GMT -5. The time now is 11:38 PM. |