Find the answer to your Linux question:
Results 1 to 5 of 5
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 ...
  1. #1
    Just Joined!
    Join Date
    Dec 2008
    Posts
    1

    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)?

    Thanks,
    Amita.

  2. #2
    tpl
    tpl is offline
    Linux User
    Join Date
    Jan 2007
    Location
    cleveland
    Posts
    452
    welcome to the forum

    "export foo=bar"

    makes available to any program that scans the
    environment, the value "bar" for the environment variable "foo"

    as for your question about /etc/profile vs /etc/bashrc, you
    will find "man bash" gives a good explanation.
    the sun is new every day (heraclitus)

  3. #3
    Trusted Penguin Cabhan's Avatar
    Join Date
    Jan 2005
    Location
    Seattle, WA, USA
    Posts
    3,230
    The profile vs. rc thing has to do with the differences in behaviour between interactive and non-interactive shells. I can't remember the exact differences, but Google should tell you.

    As for what purpose environment variables have, remember that EVERYTHING is run from a shell. In the case of a non-CLI program, it is executed by the window manager / desktop environment, which was itself executed by a shell. So assuming that the shell has the right properties set, everything will be affected.

    Having said that, the only way to make the shell aware of changes is to tell it to reload its configuration or start up a new shell. So to make your UI aware of environment changes, you need to actually shut down the system (or, if you can, fully log out, including shutting down the UI).
    DISTRO=Arch
    Registered Linux User #388732

  4. #4
    Just Joined!
    Join Date
    Oct 2007
    Location
    Vancouver
    Posts
    9

    Environment Variable not configured

    I modified my .bash_profile to include the following line at the tail end of the file:

    export CATALLINA_HOME=/home/patrick/apache-tomcat-6.0.20

    I then opened a terminal window and typed:

    echo $CATALINA_HOME. Nothing appeared. Am I missing something?

  5. #5
    Blackfooted Penguin daark.child's Avatar
    Join Date
    Apr 2006
    Location
    West Yorks
    Posts
    4,344
    You need to logout and back in again for the variable to become effective. If you don't want to log out, you can start a terminal and run "source .bash_profile", The new variable will only work in that terminal window.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...