KDM and .bash_profile problem

RW list-freebsd-2004 at morbius.sent.com
Tue Jun 14 14:09:32 GMT 2005


I think it used to be the case that if you used kdm to login, 
then .bash_profile would not get sourced by bash (because it's not a login 
shell). However it appears that  the Xsession script 
in  /usr/local/share/config/kdm now sources .bash_profile explicitly if bash 
is your shell.

My problem is that when .bash_profile is sourced this way, I only pick-up 
environmental variables, and any aliases or bash functions don't work. They 
work as expected when I login via a virtual-terminal, so I don't think it is 
my script. 

For those who don't have kdm, this is the Xsession file:
--------------------------------------------------------------------------
#! /bin/sh
# Xsession - run as user

session=$1

# Note that the respective logout scripts are not sourced.
case $SHELL in
  */bash)
    [ -z "$BASH" ] && exec $SHELL $0 "$@"
    set +o posix
    [ -f /etc/profile ] && . /etc/profile
    if [ -f $HOME/.bash_profile ]; then
      . $HOME/.bash_profile
    elif [ -f $HOME/.bash_login ]; then
      . $HOME/.bash_login
    elif [ -f $HOME/.profile ]; then
      . $HOME/.profile
    fi
    ;;

# ...OTHER SHELL CASE ENTRIES SNIPPED  #

esac

[ -f /etc/xprofile ] && . /etc/xprofile
[ -f $HOME/.xprofile ] && . $HOME/.xprofile

case $session in
  "")
    exec xmessage -center -buttons OK:0 -default OK "Sorry, $DESKTOP_SESSION 
is no valid session."
    ;;
  failsafe)
    exec xterm -geometry 80x24-0-0
    ;;
  custom)
    exec $HOME/.xsession
    ;;
  default)
    exec /usr/local/bin/startkde
    ;;
  *)
    eval exec "$session"
    ;;
esac
exec xmessage -center -buttons OK:0 -default OK "Sorry, cannot execute 
$session. Check $DESKTOP_SESSION.desktop."
--------------------------------------------------------------------------




More information about the freebsd-questions mailing list