LinuxQuestions.org
Register a domain and help support LQ
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 04-08-2009, 05:46 PM   #1
kiwi_MTBer
LQ Newbie
 
Registered: Nov 2008
Location: Chch, NZ
Distribution: Fedora 10
Posts: 18

Rep: Reputation: 0
$CFLAGS and $PATH - how to change them so that they stay permanent


export %CFLAGS="......." and same with $PATH, changes them only while I have a session going. If I restart the changes I have made are no longer there. I'm presuming theres a file somewhere where I can make permanent changes by adding a line or two?

Any help is appreciated
 
Old 04-08-2009, 05:50 PM   #2
kenoshi
Member
 
Registered: Sep 2007
Location: SF Bay Area, CA
Distribution: CentOS, SLES 10+, RHEL 3+, Debian Sarge
Posts: 159

Rep: Reputation: 32
Add it to your profile. Either .profile or .bash_profile in you home directory.

For system wide changes, stick them in /etc/profile, though this is rarely done.

Hope this helps.
 
Old 04-08-2009, 05:55 PM   #3
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,040

Rep: Reputation: 373Reputation: 373Reputation: 373Reputation: 373
Environment is something specific to the shell.

So it really depends on what shell do you use. Nowadays it's bash in 99% of the distributions out there by default. So you are looking for the bash initialization files. For global you can use /etc/profile. For user specific stuff you could use ~/.bashrc (interactive non-login shells, like in xterm) or ~/.bash_profile (interactive and login shells, like when you login in text mode, outside X).

If you want a complete list for bash, check the INVOCATION section in the bash man page. For other shells, check their respective man pages.
 
Old 04-09-2009, 04:01 PM   #4
kiwi_MTBer
LQ Newbie
 
Registered: Nov 2008
Location: Chch, NZ
Distribution: Fedora 10
Posts: 18

Original Poster
Rep: Reputation: 0
Thanks guys, that has worked. Placing 'export......' into ~/.bashrc produced an error when I opened a terminal, but removing that and putting it in ~/.bash_profile seems to have done the trick.

Cheers
 
Old 04-09-2009, 04:07 PM   #5
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,040

Rep: Reputation: 373Reputation: 373Reputation: 373Reputation: 373
Those files are twins, whatever goes in either of them can go in the other, so I guess there were some typo or whatever in there that produced the error. However without knowing which kind of error it was I can only guess.
 
Old 04-09-2009, 04:53 PM   #6
unSpawn
Moderator
 
Registered: May 2001
Posts: 27,308
Blog Entries: 54

Rep: Reputation: 2857Reputation: 2857Reputation: 2857Reputation: 2857Reputation: 2857Reputation: 2857Reputation: 2857Reputation: 2857Reputation: 2857Reputation: 2857Reputation: 2857
Quote:
Originally Posted by i92guboj View Post
Those files are twins, whatever goes in either of them can go in the other
Close but not completely right AFAIK: Bash in interactive login shell mode reads ~/.bash_profile but not in interactive non-login shell or non-interactive mode.
 
Old 04-09-2009, 05:50 PM   #7
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,040

Rep: Reputation: 373Reputation: 373Reputation: 373Reputation: 373
Quote:
Originally Posted by unSpawn View Post
Close but not completely right AFAIK: Bash in interactive login shell mode reads ~/.bash_profile but not in interactive non-login shell or non-interactive mode.
I already sorted out that in the post previous to that one

I mean that syntactically speaking there's nothing that you can put in one of those files that would cause an error in the other (nor in any other bash script, by that means). And much less, when it comes to something as simple as setting and exporting a variable.

Last edited by i92guboj; 04-09-2009 at 05:51 PM.
 
Old 04-09-2009, 06:15 PM   #8
unSpawn
Moderator
 
Registered: May 2001
Posts: 27,308
Blog Entries: 54

Rep: Reputation: 2857Reputation: 2857Reputation: 2857Reputation: 2857Reputation: 2857Reputation: 2857Reputation: 2857Reputation: 2857Reputation: 2857Reputation: 2857Reputation: 2857
Yeah, you're right. I read over that.
 
Old 04-16-2009, 09:51 PM   #9
kiwi_MTBer
LQ Newbie
 
Registered: Nov 2008
Location: Chch, NZ
Distribution: Fedora 10
Posts: 18

Original Poster
Rep: Reputation: 0
At the bottom of .bashrc I had export $PATH="..." which produced this error:

Code:
bash: export: `...........': not a valid identifier
Obviously now the $ shouldn't have been there, so yea it was a typo which caused the error
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Permanent PATH variable with azureus dreamcatcheromerta Linux - Newbie 4 11-06-2008 07:31 PM
make a change permanent ubuntu sunnior Linux - Newbie 6 07-20-2008 10:41 PM
Permanent hostname change in OS X 10.4 air4s_1 Other *NIX 1 06-16-2006 03:40 PM
Where to change CFLAGS in Fedora Core 2? black hole sun Fedora 3 09-26-2004 05:17 PM
How to make a PATH stay in the environmental variables after closing the terminal.... jmax24 Linux - General 4 04-18-2004 11:47 PM


All times are GMT -5. The time now is 03:33 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration