Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Setting environment variables in ubuntu

Posted on 2006-04-06
3
Medium Priority
?
2,365 Views
Last Modified: 2013-11-15
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.
0
Comment
Question by:chsalvia
3 Comments
 
LVL 3

Accepted Solution

by:
sheetbird earned 1000 total points
ID: 16395105
try putting in .~/bashrc  in your home directory.

This will only work for that user however.  It seems strange that it doesn't work in /etc/profile, it should.    Look in ~/.bash_profile ~/.bash_login and ~/.bashrc to make sure it's not getting set to null e.g.  export CPATH;
0
 
LVL 88

Expert Comment

by:rindi
ID: 16398575
Did you try it without the "export"?
0
 

Author Comment

by:chsalvia
ID: 16408056
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

0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

SSH (Secure Shell) - Tips and Tricks As you all know SSH(Secure Shell) is a network protocol, which we use to access/transfer files securely between two networked devices. SSH was actually designed as a replacement for insecure protocols that sen…
You ever wonder how to backup Linux system files just like Windows System Restore?  Well you can use Timeshift in Linux to perform those similar action.  This tutorial will show you how to backup your system files and keep regular intervals. Note…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Suggested Courses
Course of the Month21 days, 7 hours left to enroll

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question