Subject: Re: .profile
To: David Laight <david@l8s.co.uk>
From: Frederick Bruckman <fredb@immanent.net>
List: netbsd-help
Date: 04/14/2003 08:57:18
On Mon, 14 Apr 2003, David Laight wrote:

> On Mon, Apr 14, 2003 at 02:33:12PM +0930, Ian Grant wrote:
> >
> > I've discovered that my .profile is not being read when a shell is
> > spawned. I'm using /bin/sh so why would ~/.profile not be read?
> > Or perhaps a better question is where do I set my environment variables
> > for /bin/sh ?
>
> How/where are you spawning /bin/sh?
> Only 'login' shells read ~/.profile the rest just inherit the parents env,
> If you are runing xterm you need to do 'xterm -ls'
> (that ought to be the default for window managers running xterms, but...)

Bah. How many times do you need to set your path? (I say "once".)
You can't launch an xterm unless you're already logged in, and if your
login was via "xdm", ~/.xsession simply takes the place of ~/.profile.

To answer the first question, non-login shells source ${ENV}, which
has no default, so you have to set it in ~/.profile or ~/.xsession
(typically to ~/.shrc or ~/.shinit). It's all explained in the man
page for the shell.

Frederick