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

Re: .bash_profile and X



Dai Yuwen <yuwen@micetek.com.cn> writes:

> I'm running xdm + fvwm. And my shell is /bin/bash.  I find any
> variable I set in ~/.bash_profile doesn't take effect after I've login
> X.

Well, sure: nothing in the "logging in via X sequence" runs bash as a
login shell (shell scripts might get run via /bin/sh, but IIRC that
definitely doesn't read .bash_profile).  I like to create a .variables
script that sets a bunch of environment variables, and then read it
from both .zshrc (or .bashrc) and .xsession; this approach would look
like

  # .variables: set environment variables
  PATH=$PATH:$HOME/bin
  CLASSPATH=.
  export CLASSPATH

  #!/bin/sh
  # .xsession: run user commands for X
  set +m
  . $HOME/.variables
  xrdb -cpp m4 $HOME/.Xresources.m4
  epist &
  xwrits typetime=6:30 breaktime=1:00 clock mouse &
  exec openbox

The other frequent suggestion is to just read your .bashrc (or
.bash_profile, etc.) from .xsession, instead of creating a separate
file for environment variable settings.  YMMV.

-- 
David Maze         dmaze@debian.org      http://people.debian.org/~dmaze/
"Theoretical politics is interesting.  Politicking should be illegal."
	-- Abra Mitchell



Reply to: