Problem with bash login.

Steven W. Orr steveo at syslang.net
Sun Jul 16 11:50:01 EDT 2006


On Sunday, Jul 16th 2006 at 07:28 -0400, quoth Paul Lussier:

=>"Steven W. Orr" <steveo at syslang.net> writes:
=>
=>> 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.
=>
=>[...snip...]
=>
=>> People must have done this in the past.
=>
=>Sure, in .bashrc, all I have is:
=>
=>  if [ -f /etc/bashrc ]; then
=>          . /etc/bashrc
=>  fi
=>
=>  # User specific aliases and functions
=>
=>  if [ -f ~/.profile ]; then
=>          . ~/.profile   # I came from a ksh world, and this "just works"
=>  fi
=>
=>
=>in .profile (or .bash_profile if you prefer) I have:
=>
=>  ENV=$HOME/.profile
=>  SHELL=/bin/bash
=> 
=>And a whole bunch of other variables like PATH, MANPATH, INFOPATH,
=>etc., all of which at some point get exported as well.

Lord save us from convoluted logic. (It is Sunday after all.)

The purpose of the .bash_profile (essentially) is to define environment 
variables. It's also to be used to set seperate process values which are 
inherited (e.g., umask etc...)

If you are setting your variables in your .bashrc (even if it's by 
sourcing your .bash_profile then you're doing it wrong.

------------From .bash_profile-----------
export FOO=bar
------------From .bash_profile-----------

------------From .bashrc-----------------
. ~/.bash_profile
------------From .bashrc-----------------

echo $FOO
export FOO=baz
bash
echo $FOO

QED that in a sandwich.

I am not near a gdm login and won't be for a few days, but any proper 
solution *must* set variables in the login process and not in each 
subshell. There have been a couple of suggestions about how to craft a 
.session file which I'll try when I get back.

It may very well be that part of the problem is historical since so many 
people used csh way back when. The csh doesn't even have a proper login to 
begin with so it may not have been noticed by most over the years.

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