On Fri, 23 Jun 2006 18:46:16 -0400 Derek Martin <[EMAIL PROTECTED]> wrote:
> On Sat, Jun 24, 2006 at 12:00:03AM +0200, Pavlos Parissis wrote: > > Hello all, > > > > I have been trying to make my X to source the .bash_profile in order > > to set my $PATH variable. > > .xsession is the best place to deal with this, but you need to start > your X session in this file, or else it will just end. For example, > my .xsession file looks like this: > > #!/bin/bash > > # start my X session > > if [ -f ~/.bashrc ]; then > . ~/.bashrc > fi > xrdb -merge .Xdefaults > ssh-agent gnome-session > > This starts gnome, and runs it from ssh-agent. That's a neat trick > which makes your ssh agent accessible to all xterms started from > within your X session. If you use KDE, replace that with startkde. Side effect of that approach is that you have to use only one Desktop Environment. I was trying to avoid to set my Desktop Environment from ~/.xsession because I like the option to change the D.E. from the xdm/gdm/kdm when I login. Thus, I didn't follow this approach which is documented in Debian reference. It seams that I have to take this path anyways. > The key is, once this script ends, so does your X session. If you > just source your .bashrc file, your X session will end before it has a > chance to start. ;-) That's explain why it was not working for me the trick to just source the ~/.bash_profile from ~/.xsession without starting a window manager/D.E.. > > Since ~/.bashrc is invoked by no login shell I don't really mind to > > use this trick. But, I do mind that fact that I have duplicate > > information, $PATH is set in two files. > > The usual way to handle this is to put environment initialization > commands only in .bashrc, and source .bashrc from .profile (or > .bash_profile). Note that you don't want to put commands which > generate output in .bashrc -- if you do this, it can cause problems > for your ssh sessions (particularly using scp, etc.) which will > receive the output of the .bashrc script, and corrupt the data stream. > To counteract that problem, only put commands which generate output in > .profile (or .bash_profile). It sounds a good a idea and practice to move my environment variables to ~/.bashrc. Thank you very much, Pavlos -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]