Link to home
Start Free TrialLog in
Avatar of chsalvia
chsalvia

asked on

Setting environment variables in ubuntu

I'm trying to permanently set some environment variables in ubuntu.  I want to set CPATH and LD_LIBRARY_PATH.  So, I go to /etc/profile and add in the following commands:

export CPATH="/mypath"
export LD_LIBRARY_PATH = "/mypath"

I restart Linux, and when I type echo $CPATH on the bash terminal, my specified path does not appear.  The variable is empty.

So, I have to keep typing export CPATH="/mypath" everytime I open up a bash window.  How do I set these variables permanently?

Thanks.
ASKER CERTIFIED SOLUTION
Avatar of sheetbird
sheetbird

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of rindi
Did you try it without the "export"?
Avatar of chsalvia
chsalvia

ASKER

Okay, I got it working.  

For some reason ubuntu ignored my commands when I placed them in /etc/profile or in ~/.bash_profile or other user-specific settings files.

It only worked when I placed it in /etc/bash.bashrc