-   Linux - Newbie (
-   -   Setting up environment variables (

amita0204 12-23-2008 04:04 PM

Setting up environment variables
What is the difference between setting up environment variables by editing .bashrc (or/etc/bash.bashrc) file and /etc/profile file (apart from setting up for single user and all user)?
Bash is a type of shell. So will editing .bashrc or or bash.bashrc file make changes only to shell run commands/applications? Or will the changes get applied to applications like eclipse (not invoked from the command line)?


Su-Shee 12-23-2008 05:17 PM

It depends on your login mechanism and the shell you use.

.bashrc certainly only makes sense if you're actually use bash - you might change to tcsh or csh or zsh or whateversh and they don't load .bashrc - they have a .tcshrc or .cshrc and so on. Other shells may also have a different syntax to set environment variables - what's "export" in bash is "setenv" in tcsh, for example.

There may be a local .bashrc, .bash_profile, .bash_login (sticking with bash as an example here..) and a .bash_logout and the .profile.

See "man bash" the section about "invocation" for details and for which file is loaded depending on what.

Wether or not it influences only command line application depends usally on how you login and invoke your X and afterwards if you use your command line in an xterm it depends on how you invoke your xterminal program.

An environment has to be set somewhere to be read by an application later on. Eclipse probably doesn't care where your environment comes from as long as the environment itself is correct - CLASSPATH 'n'stuff I assume.

Many people stumble upon this when they see a difference in loading some X application via some menu or icon or if they start it from within their xterminal.

All times are GMT -5. The time now is 12:10 AM.