Re: My .profile is not read?

Raphaël Droz <[email protected]>
Newsgroups gmane.comp.window-managers.fluxbox.user
Message-ID <[email protected]>
On Wed, Sep 14, 2011 at 08:56:53PM -0700, John W wrote:
> Hi,
> 
> I recently started trying out fluxbox, and while I am generally happy,
> something is wonky with how my shell starts up.
> I have various env. vars set up in my .profile, and some aliases in my
> .bashrc, etc.
> 
> Yet, when I spawn a new xterm from within fluxbox, I get a vanilla
> instance of bash - it does not read my .profile.
> 
> I do not have this issue, for example, when spawning an xterm from inside Xfce.
> 
> I'm not sure if it's really fluxbox related or some other X issue, but
> any pointers would be appreciated.
> 
> Note: I am launching fluxbox from a shell that has everything set up
> right (has my custom prompt, etc from .profile), but fluxbox doesn't
> seem to want to inherit that stuff.

.profile is read by login shell [1]
your xterm does not run a *login* shell thus only reads .bashrc.

.profile exported values will affect fluxbox and xterm *if* fluxbox itself
was launched into a login shell (or if the shell used to run fluxbox
from loaded your .profile in some way).


Some people often do things like this in .bashrc:

[[ -z $PROFILE_LOADED ]] && . .bash_profile
# make sure that .bash_profile does not load .bashrc BEFORE setting up $PROFILE_LOADED

But you can also configure your login manager (qingy, gdm, ...) to use
your .xsession file to run X.
For example here is mine:

#!/bin/bash

# some stuff with variables like MAILDIR, HISTCONTROL + loading common
# routines from .bashrc.d/common_profile/*.sh
[[ "$ENV_BP" != yes && -r $HOME/.bash_profile ]] && . $HOME/.bash_profile

# define the profile to use, eg ENV_PROFILE=desktop or ENV_PROFILE=eeepc, ...
[[ "$ENV_BC" != yes && -r $HOME/.bashrc.d/profile ]] && . $HOME/.bashrc.d/profile

# my equivalent to .fluxbox/startup file (will also setup $ENV_WM_CONFIG)
__env_loader "$HOME/.xinitrc.d/$ENV_PROFILE"

# exec fluxbox
exec /usr/bin/fluxbox -verbose -log $ENV_SOURCE/.fluxbox/log -rc $ENV_WM_CONFIG


regards


Raph

[1] man bash, chapter "INVOCATION", look for "interactive" mode.

------------------------------------------------------------------------------
BlackBerry&reg; DevCon Americas, Oct. 18-20, San Francisco, CA
http://p.sf.net/sfu/rim-devcon-copy2
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.