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

Re: I'm really confused by bash, .bashrc, .bash_profile, .profile, etc, etc, etc



Mark Wright wrote:

> Is there a good system for setting variables, aliases, etc that need to be
> set for user X, whether I log in at a login prompt or using su?  I'm
> confused by all the different .profile options (there are at least 3 for
> bash, why is that?)

I don't know if there is such a system/program but I can help you clear things up.

Each of these files are read by bash at different times:

.bash_profile is executed when you login.
Stuff you put in there might be your PATH and other important environment variables.

.bashrc is used for non login shells. I'm not sure what that means. I know that RedHat

executes it everytime you start another shell (su to this user or simply calling bash
again)
You might want to put aliases in there but again I am not sure what that means. I
simply ignore it myself.

.profile is the equivalent of .bash_profile for the root. I think the name is changed
to let other shells (csh, sh, tcsh) use it as well. (you don't need one as a user)

There is also .bash_logout wich executes at, yeah good guess...logout.
You might want to stop deamons or even make a little housekeeping .
You can also add "clear" there if you want to clear the screen when you log out.

I hope it helps you understand...

--
 Jean-Pierre Parent <parentjp@videotron.ca>


Reply to: