Subject: Re: Weird bash .profile and picky Xorg MANPATH
To: Steven M. Bellovin <smb@cs.columbia.edu>
From: Kosta Kilim <kopno@sdf.lonestar.org>
List: netbsd-users
Date: 05/12/2005 00:15:32
On Wed, May 11, 2005 at 02:50:12PM -0400, Steven M. Bellovin wrote:

> In message <20050511181928.GA16617@SDF.LONESTAR.ORG>, Kosta Kilim writes:
>
> >I've set up .profile to my liking and everything works fine while I'm
> >at the console, but once I startx into Xorg, every instance of the
> >login shell in a xterm that I bring up doesn't read it. Or to clarify,
> >it reads my PS1 setting just fine, but not my alias settings, some of
> >which are:
> >
> >alias m='less'
> >alias e='emacs'
> >
> >The shell in question is bash and I've chsh-ed it after installing it
> >via pkgsrc. I don't have .bash_profile in my $HOME.
> >
> >Once I run ". .profile" it reverts back to normal behavior. But only
> >for the particular invocation of xterm + bash. I have to do this in
> >every other xterm for it to take effect. Not halal.
> >
> In general, xterms should not read .profile files; they're not login 
> shells.  Set up your environment variables in your .profile read at 
> login time, and put anything else in the per-shell file -- I use 
> (pd)ksh rather than bash, so I don't know what it would be for you; for 
> me, I set ENV to point to $HOME/.env and put my aliases in that file.

Hi,

Thanks for the advice, it makes sense. But I just noticed another 
strange thing:

all the aliases work fine when I log into the console, but if I do:

'su -m' 

the PS1 varable is being read, while the aliases aren't whilst root.

I've tried it both ways: 

1. having the aliases declared in the .profile
2. having ENV=/home/kopno/.shrc; export ENV

In 1. my aliases are read as the normal user and they are usable.
In 2. my aliases arent being read by bash at all

Then I read bash info page from another system and it says that bash's 
equivalent of ENV is BASH_ENV. So I did:

BASH_ENV=/home/kopno/.shrc; export BASH_ENV

Loged out and in, nothing. No effect as far as the aliases are concerned,
the PS1 is being read without problem and it is declared in .profile.

bash's man page says:

... 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.

So I did ln -s .profile .bash_profile and that works like before. Whilst
it has no effect on 'su -m'.

Is this a bash issue ? Or .... ?

Oh yea, just in case you might be wondering:

ls -la .profile
-rw-r--r--  1 kopno  wheel  463 May 12 02:22 .profile


Thanks