LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How to edit .bashrc such that I don't need to export on every new session? (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-edit-bashrc-such-that-i-dont-need-to-export-on-every-new-session-865354/)

golmschenk 02-27-2011 04:20 PM

How to edit .bashrc such that I don't need to export on every new session?
 
I want something like
Code:

export ROS_PACKAGE_PATH=~/ros:$ROS_PACKAGE_PATH
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!

Telengard 02-27-2011 04:23 PM

Insert the line as is at the bottom of ~/.bashrc should do the trick I think.

turtlegeek 02-27-2011 04:52 PM

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.

golmschenk 03-07-2011 09:20 PM

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!


All times are GMT -5. The time now is 01:14 AM.