Re: Where is PATH variable set ?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On November 30, 2003 12:20 pm, Abhijeet Dharmapurikar wrote:
> Allrite here are my further questions..
> 1.when is /etc/profile run ? IS it when starting the
> system services like crond inetd or after a user logs
> in?
>
> 2. whats the difference between .bash_profile and
> .bashrc ?
>
> Regards,
> Abhijeer

Hi,
These files are all run whenever a login is required. It does can be either a 
user accessing a terminal or a script calling an environment to execute in. I 
beleive they are all triggered by /bin/login, but I may be wrong on that. 

Here is how the login process works:
If it is an interactive logon (uses a tty, get a command prompt) things are 
read in this order:
1) /etc/profile -sets global environment defaults
2) shell scripts in /etc/profile.d are executed
3) ~/.bash_profile
4) ~/.bashrc
5) /etc/bashrc

For non-interactive logins such as a cron job, it is a bit different:
1) ~/.bashrc
2) /etc/bashrc
3) shell scripts in /etc/profile.d are executed

On logout, ~/.bash_logout runs.

(these are RH order, I think it is slightly different for some other dists)

As far as the diff between .bashrc & .bash_profile
~/.bash_profile calls .bashrc and set any user specific environmental 
variables
~/.bashrc calls /etc/bashrc and sets things like command aliases

-- 
Pete Nesbitt, rhce


-- 
redhat-list mailing list
unsubscribe mailto:redhat-list-request@xxxxxxxxxx?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/redhat-list

[Index of Archives]     [CentOS]     [Kernel Development]     [PAM]     [Fedora Users]     [Red Hat Development]     [Big List of Linux Books]     [Linux Admin]     [Gimp]     [Asterisk PBX]     [Yosemite News]     [Red Hat Crash Utility]


  Powered by Linux