Comment 13 for bug 1468832

Revision history for this message
Sigurd F (sigurdf) wrote :

> The user's .profile is to be read by the shell, on interactive shell
> (i.e. terminal) logins ONLY

This is incorrect, .profile is read by the shell also when the shell is
non-interactive. Here is the quote from the bash manual:

> When Bash is invoked as an interactive login shell, or as a
> non-interactive shell with the --login option, it first reads and
> executes commands from the file /etc/profile, if that file exists.
> After reading that file, it looks for ~/.bash_profile, ~/.bash_login,
> and ~/.profile, in that order, and reads and executes commands from the
> first one that exists and is readable.

A not so far fetched example of a non interactive login shell is
something like this, where I want to source .profile but not .bashrc

$ ssh localhost "bash --login -c 'env'"

This means that .profile might be read with no tty attached, and we
should test for the presens of an attached tty when invoking stty in
.profile

.profile:
tty -s && stty erase ^H

I am interpreting a xsession as a login shell that should source .profile.