Visit Jeremy's Blog.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 02-27-2011, 04:20 PM   #1
Registered: Nov 2009
Posts: 144

Rep: Reputation: 15
How to edit .bashrc such that I don't need to export on every new session?

I want something like
to be done already for me when I open a new terminal. How do I edit the .bashrc so that this variable is always set already? Thanks for your time!
Click here to see the post LQ members have rated as the most helpful post in this thread.
Old 02-27-2011, 04:23 PM   #2
Registered: Apr 2007
Location: USA
Distribution: Kubuntu 8.04
Posts: 579
Blog Entries: 8

Rep: Reputation: 148Reputation: 148
Insert the line as is at the bottom of ~/.bashrc should do the trick I think.
Old 02-27-2011, 04:52 PM   #3
LQ Newbie
Registered: Feb 2011
Location: Georgia, USA
Distribution: xubuntu, Mac OS X
Posts: 5

Rep: Reputation: 16
You might want to read the man page for bash and search (type "/" followed by the keyword) for INVOCATION. I think you might be mistaken about the function of the .bashrc file. Perhaps you want the .bash_login file. Reading the /etc/bash.bashrc file might provide some enlightenment. If the bash script is not connected to a terminal, i.e. not interactive, then other rules apply.

That notwithstanding, if you are executing the .bashrc file instead of including it using the "." or dot command, then you won't see the variable unless set somewhere else directly in the code.

To see what variables and options are set in a terminal, type "set" and enter.

Last edited by turtlegeek; 02-27-2011 at 04:53 PM. Reason: adding a hint
2 members found this post helpful.
Old 03-07-2011, 09:20 PM   #4
Registered: Nov 2009
Posts: 144

Original Poster
Rep: Reputation: 15
Oops, forgot to respond to this. Adding it to the end of the bashrc file does work thanks.

However, after looking more into the bash stuff I understand that using the bash_login is probably a better choice. It wasn't working when I tried it just recently though. I know it's the correct way, but I'll fix it when I have more time to tweak things. Thanks to both of you!



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
How to edit .bash_profile and .bashrc files? LinuxInfo Programming 9 07-21-2012 09:19 AM
[SOLVED] Export path and edit bash vodka_linux Linux - Newbie 3 01-07-2011 02:41 PM
newbie question : how to edit bashrc pingu99 Linux - Software 5 10-26-2010 07:22 PM
Reply & edit session window differences onebuck LQ Suggestions & Feedback 5 09-14-2010 09:38 AM
Cygwin .bashrc settings not carrying over to startx Xwin session kk_oop Linux - General 2 09-10-2009 08:25 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:43 PM.

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