ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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?
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.
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?
Originally posted by sk8guitar 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?
By shell I asusme you mean bash?
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.