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. Thank you |
Oh, and I also have the export PATH in .bash_profile after setting the variable.
|
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 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). |
Thank you for your help. As I didn't find other options, I have created .profile file with the same command and this time it worked.
|
Glad you found a solution :)
Threads can be marked SOLVED via the Thread Tools menu. |
All times are GMT -5. The time now is 10:13 AM. |