[SOLVED] Why is the environment variable set in .bash_profile is not being in effect ?
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's 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.
Why is the environment variable set in .bash_profile is not being in effect ?
Hi All, I am new to Linux and I got an opportunity to work on Linux now. I am quite excited, but had to post this simple question for all of you.
We had DB2 software installed in a specific directory /IBM/db2/V9.7/bin and my PATH variable isn't set for this. So, for all the db2 commands I have to type the path with command. So, I have updated the PATH variable at $ prompt and exported the variable, and it worked successfully. But after I logged off and logged back in, I had to do it again. So, with little knowledge and searching around I found .bash_profile where I could append the path to existing PATH. So, i have updated the .bash_profile with PATH=$PATH:/IBM/db2/V9.7/bin and logged off and logged back in again. Still I do not see the changes for the PATH variable taking effect from my .bash_profile. So, wondering if there is something else I need to do. Please let me know if you have any ideas on how I could get this resolved.
bash_profile is usually read by login shells, but not by non-login interactive shells. Those generally use bashrc. Read the INVOCATION section of the bash man page for details on the start-up files used in your distribution.
Thank you for the information. I have tried .bashrc also, and it is still not working. So, I am reading the books now to see if there is anything else, and will post the answer as soon as I find the solution.
What you have described should work. If your ~/.bash_profile contains
Code:
export PATH=$PATH:/IBM/db2/V9.7/bin
then the PATH should be modified.
How to diagnose the problem? One possibility is that PATH is being set to some other value later. To see what is happening you could add set -x at the beginning of ~/.bash_profile and log on at a virtual console (accessed from a graphical desktop by Ctrl+Alt+F1 or F2 ... Get back to the graphical desktop by typically Ctrl+Alt+F7 but try others if that doesn't work).
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.