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

Re: Where is $MAIL set? (login process)

On Tue, Jun 03, 2003 at 04:54:46PM +0100, Ben Kal wrote:

> The login process:
> The man pages of
> - login
> - xdm
> - bash or tcsh or any other shell you use
> are pretty clear about what happens (mostly what startup scripts they
> execute) under what circumstances. Issues to be aware of are:
> - xdm replaces login but does not set up the environment in exactly the same
>   way as login does, in particular it does not set MAIL as you have found
> - the shell of an X terminal is not a login shell (the user is already
>   logged in through xdm) so the startup scripts for login shells,
>   /etc/profile and ~/.bash_profile in the case of bash, are not executed!
>   This easily causes the environment of shells on virtual consoles to be
>   radically different from the environment of shells in X terminals.

Yes, so now I'm sourcing those in my .xsession file.

> - environment variables have to be set only once and are inherited by all
>   processes that are children of the login shell or the X session,
>   but things like aliases and shell options have to be set every time
>   a shell is started.

Good to know.  (I'm still not clear about variables shown with "set", 
but I'm sure that's just a google away...)

> To ensure that:
> - the environment is the same in all shells
> - on startup shells do not read more startup scripts than necessary
> I did the following:
> - put all settings of environment variables in /etc/profile and ~/.bash_profile
> - put all aliases and shell options in /etc/bash.bashrc and ~/.bahsrc
> - made /etc/profile source /etc/bash.bashrc
> - made ~/.bash_profile source ~/.bashrc
> - made ~/.xsession source both /etc/profile and ~/.bash_profile,
>   after setting an environment variable that to /etc/profile and ~/.bash_profile
>   signals that they have been sourced by ~/.xsession;
>   in that case they do not need to source /etc/bash.bashrc resp. ~/.bashrc,
>   and instead unset that environment variable.

Thanks, that's very helpful.

Bill Moseley

Reply to: