Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
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.
I'm new to Linux and trying to add additonal directories to my environment. i have create a command file/script to just at additional directories to my environment as follows:
If key the commands in a terminal window they are applied to my environment. If I place these command in a file and execute them they are not. I use "env" to check enviroment and the "PATH" variable does not show the directories added. However, if I enter them by hand and then do an "env" they do show up. Can anyone tell me what's happing?
I've add the command to my startup profile and they work just fine. I would really like to execute them from a command file. I'd like to have a command file for each application environment to be executed from a command file. I really want them to be functions that I can use any where I like.
Thanks for your help I was not source the file properly. I was only using the following: "./filename" when i changed it to ". ./filename" it worked just fine. However, I do have another question. Shoudn't "lib" and "include" be include in the path to ensure that the application knows where everything is located that it may need?
No. If you just want the javac, java, etc commands then you just need to put the ...../bin dir in the path. When you run the program it knows where everything else is. It knows where to search for files without you giving it a path for the "extra stuff." If there are other executables that you will actually use then you should include those dirs as well.
Originally posted by louisb Thanks for your help I was not source the file properly. I was only using the following: "./filename" when i changed it to ". ./filename" it worked just fine. However, I do have another question. Shoudn't "lib" and "include" be include in the path to ensure that the application knows where everything is located that it may need?
The PATH variable should only include directories containing binaries. There are other variables to specify the "extra stuff" (as benjithegreat98 put it). For example, java uses CLASSPATH. If your binaries are properly built (and they usually are), they will know to look in lib for libraries.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.