All Gurus once were Newbies
There are no such things as "stupid" questions. However if you think your question is a bit stupid, then this is the right place for you to post it. Please stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions prefer the other forums within the support section.
Before you post please read how to get help
Hi to all,
I am trying to set path for an application I have installed. What i'm trying to wrap my head around is if I want an environment variable to work in all terminals is it recommended I edit bash.bashrc or /etc/environment. Alternatively could I source bash.bashrc from ~/.bash_profile for this to work? What are the pros and cons?
So if I edit .bashrc then source that from ~/.bash_profile would that be a safe bet?
Im confused as there is no .bashrc or profile_bash by default and the default paths are set in etc/environment so is there any reason i can't just set the path in /etc/environment?
I think i'm over complicating the matter, i am however determined to wrap my head around this.
- Level 1
- Posts: 5
- Joined: Tue Feb 09, 2010 7:07 am
Environment variables and aliases defined or set in /etc/environment are applied system-wide; all variables inside it are applied to all users, including root.
Things defined or set in ~/.bashrc are applied to the user's session only upon login. This file is often used to define shell variables specific to a user's shell environment needs.
~/.bash_profile is a script that gets executed upon login. It may or may not contain a line that sources ~/.bashrc. /etc/profile is similar in purpose, except that it's system-wide -- it gets executed when anybody logs in.
Conclusion: Yes, sourcing ~/.bashrc from ~/.bash_profile is a safe bet.
- Level 5
- Posts: 746
- Joined: Sat Aug 30, 2008 2:55 am
- Location: /root
Users browsing this forum: Bing [Bot], PtahX, xenopeek and 21 guests