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

Re: Bash in xterm under x*3.3.2.3a-6




On 3 Nov 1998, Rob Browning wrote:

> joost@pc47.mpn.cp.philips.com writes:
> 
> > I put this in my .bash_profile:
> > 
> >     if [ -f $HOME/.bashrc ]; then
> >         . $HOME/.bashrc
> >     fi
> 
> You're right that you want as little as possible to be re-run in
> .bashrc each time it's sourced, but as I understand it, this solution
> won't necessarily get what you want.  The problem is that not
> everything calls bash as a login shell when it should (X maybe?).

IMHO X (actually xterm) has it right the way it AFAIK works now.  You do
have to help it in doing the right thing though, which is fairly simple
and elegant, see below how I (really) do it:

> > beginning of my .xsession (which should be linked to .xinitrc AFAIC):
> > 
> >     # source login actions and definitions for this xsession:
> > 
> >     if [ -f $HOME/.bashrc ]; then
> >         . $HOME/.bashrc
> >     fi
> 
> Right, this is also a good idea.  I do this too.

DOH!  Actually I do not.  I should have pasted this from the real file..
My ~/.xsession actually has:

    if [ -f $HOME/.bash_profile ]; then
        . $HOME/.bash_profile
    fi

That way, I do get a (reasonable) login environment for the whole X
session.  

BTW, you have to be careful not to use any tildes in .rc files that get
sourced, as .xsession is sourced by /etc/X11/Xsession, which is a /bin/sh
script.  IIRC /bin/sh does no tilde expansion.

Cheers,


Joost


Reply to: