Question: order of profiles

David Bandel david.bandel
Tue Jun 19 03:46:25 PDT 2007


On 6/19/07, Dirk Moolman <DirkM at agilitytech.co.za> wrote:
> I just found a page on the web, that says:
>
> "When a user logs in, environment variables are set from various places.
> That includes /etc/profile (for all users).
> Then all the files in the /etc/profile.d directory.
> Then ~/.bash_profile, then ~/.bashrc."
>
>
> I tested this, by placing a variable in all 3 places, for a specific
> user, and then by echo'ing the variable, and removing it form 1 script
> at a time, to see in which order the scripts are being read.   And my
> test shows a different result to the web page - that they are being read
> in the order:
>
> 1. /etc/profile.d
> 2. /etc/profile
> 3. ~/.profile (in this case I do not have the .bash_profile or .bashrc
> scripts

The /etc scripts will always be sourced first followed by the users
home directory.  As for which scripts in /etc will be run first
depends on the distro (actually on the source and how it was
compiled).

For your system, go with your test results.  I don't have anything in
profile.d, so what's not there will not affect me and I haven't read
through the source.

>
>
> Can someone confirm that my test results are correct ?
>
>

Ciao,

David A. Bandel
-- 
Focus on the dream, not the competition.
            - Nemesis Air Racing Team motto



More information about the Linux-users mailing list