LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This 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


Reply
  Search this Thread
Old 01-10-2012, 05:35 PM   #1
nkdblm
LQ Newbie
 
Registered: Jan 2012
Posts: 4

Rep: Reputation: Disabled
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
 
Old 01-10-2012, 05:38 PM   #2
nkdblm
LQ Newbie
 
Registered: Jan 2012
Posts: 4

Original Poster
Rep: Reputation: Disabled
Oh, and I also have the export PATH in .bash_profile after setting the variable.
 
Old 01-11-2012, 09:41 AM   #3
David the H.
Bash Guru
 
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Arch + Xfce
Posts: 6,852

Rep: Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037
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.
 
Old 01-18-2012, 07:27 PM   #4
nkdblm
LQ Newbie
 
Registered: Jan 2012
Posts: 4

Original Poster
Rep: Reputation: Disabled
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.
 
Old 01-19-2012, 06:28 AM   #5
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
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).
 
Old 01-26-2012, 09:23 PM   #6
nkdblm
LQ Newbie
 
Registered: Jan 2012
Posts: 4

Original Poster
Rep: Reputation: Disabled
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.
 
Old 01-27-2012, 12:52 AM   #7
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
Glad you found a solution

Threads can be marked SOLVED via the Thread Tools menu.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Environment variable being set twice Mechanic Slackware 12 08-03-2010 03:22 AM
how to set environment variable pranith Linux - Newbie 1 01-27-2005 11:23 PM
set environment variable Jongi Linux - Newbie 7 03-01-2004 04:34 AM
Set Environment Variable lloyd_stevens Linux - Software 1 07-30-2003 12:38 PM
How to set a environment variable in rh? yenonn Linux - Newbie 11 02-21-2003 10:24 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:53 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration