Problem with bash login.
Steven W. Orr
steveo at syslang.net
Fri Jul 14 14:33:01 EDT 2006
On Friday, Jul 14th 2006 at 13:35 -0400, quoth Ben Scott:
=>On 7/14/06, Steven W. Orr <steveo at syslang.net> wrote:
=>> I used to view myself as one of the top authorities on bash issues.
=>
=> This isn't really a bash issue, per se...
=>
=>> How in the Wide Wide World Of Sports do I get my .bash_profile to execute
=>> when I log in using gdm.
=>
=> Do you mean for shell's started in an xterm, or for *all* programs
=>that get run from X (assuming there is a difference for you)?
=>
=> Shell's started in an xterm are non-login shells by default. That
=>means .bashrc is run, but .bash_profile is not. There's a couple ways
=>to address this. One is to add the "-ls" (I think that's it, check
=>the man page) switch to xterm, which asks for a login shell. Another
=>approach is to put everything you want in one file, and have both
=>.bashrc and .bash_profile source that file. (Or have one of them
=>source the other.)
=>
=> Now, maybe you want *all* X programs to get your .bash_profile
=>environment. That's probabbly the Right Thing anyway. Now, until
=>you start an xterm, there's nominally not going to be a bash instance
=>running at all. Having gdm fire off a shell isn't going to do
=>anything useful, because nothing else will inherit the environment
=>from that shell.
=>
=> What you need to do is put whatever environment you want in your
=>.xinitrc/.Xclients/.Xsession/whatever file. Or, more likely, put it
=>all in a separate file, and source that from both .bash_profile and
=>.xwhatever. The .xwhatever file is what gdm runs when you login.
=>It's job is to start your window manager (or session manager, or
=>desktop environment, or whatever). It is often a shell script itself.
=>
=> If you don't have an .xwhatever file, look under the /etc/X11/ tree
=>to find the system's version of it, copy that to your home directory,
=>and modify.
=>
=> Hope this helps,
This is really frustrating. I want to log into a linux box which is
running gdm such that after I have logged in, any app that I start will be
running in the environment that is normally established in my
.bash_profile. I do not set environment variables in the .bashrc because
they're not supposed to be set there. I do not want every xterm that I
start to have to be its own login process. If I was to go and set a
symlink from .bash_profile to .xsession it would be the same thing as
creating a shell script that did a cd followed by an exit. I want the
entire session to have my environment established so that when I try to
run things they will be running in the environment that I define. The
description below explains why linking .xsession to .bash_profile is a
waste of time.
allow-user-xsession
If users have an executable file called .Xsession in their home
directories, it can be used as the startup program for the X
session (see Xsession(5)). If the file is present but not exe-
cutable, it may still be used, but is assumed to be a Bourne
shell script, and executed with sh(1).
People must have done this in the past.
--
Time flies like the wind. Fruit flies like a banana. Stranger things have .0.
happened but none stranger than this. Does your driver's license say Organ ..0
Donor?Black holes are where God divided by zero. Listen to me! We are all- 000
individuals! What if this weren't a hypothetical question?
steveo at syslang.net
More information about the gnhlug-discuss
mailing list