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

Re: No sourcing of ~/.profile at login



Ashish Ariga wrote:
> Daniel B. wrote:
> > Why not?  (Why shouldn't logging in via GDM execute your login-time
> > shell initialization?)

Xsession does not know what syntax your shell is going to want.  And
$HOME/.xsession is a more general purpose way of doing it.

> That's the default behaviour. See Xsession (under /etc/X11/*)
> Change the first line "#!/bin/bash" to "#!/bin/bash --login"

Thanks for posting your solution.  But let me move the solution to
your $HOME/.xsession file instead of hacking on the system's Xsession
file.

Of course what you are suggesting will work great for bash users.  But
zsh or tcsh or whatever users will find that they still have the same
trouble as before.  If you are the only user on your machine then that
will "work for you".  But it is not a general purpose solution.

Also, if you move your home directory to another machine you have the
same problem again on that machine.  Better to make your
customizations in your $HOME directory so that if/when you move to
another machine you keep all of your customizations with you.  Also
easier to backup and restore.  Here is a good example ~/.xsession file.

  #!/bin/sh
  export PATH=$HOME/bin:$PATH:.
  # whatever you want
  exec x-session-manager  # or exec fvwm, or exec olvwm, or whatever

Don't forget to

  chmod a+x ~/.xsession

If you want to use bash and keep all changes in your $HOME/.bash_profile
you can.  In the end Xsession will run your script without whatever #!
interpreter you specify.

  #!/bin/bash
  . $HOME/.bash_profile
  exec x-session-manager

Or your bash --login works too.  I had never thought of using that in
the xsession itself.  But I believe this should work too.  I think
that is better than my previous solution above since it does all of
the right profile name search ordering.

  #!/bin/bash --login
  exec x-session-manager

For these reasons I recommend the $HOME/.xsession solution as best.

Bob

Attachment: pgpn8nLuLtSOJ.pgp
Description: PGP signature


Reply to: