On Mar 21, 2011, at 17:29, Jordan K. Hubbard wrote:
On Mar 21, 2011, at 5:11 PM, Jeremy Huddleston wrote:
I think the problem is that you are setting the values in .bashrc. X11 inherits your *login* shell environment. This is set by .profile (not .bashrc).
Actually, for bash, the login shell reads .bash_profile (and only that file - you need to explicitly load your .bashrc from within that file if you want it).
Well it reads .profile if .bash_profile and .bash_login are absent ... unless in posix mode. For anyone caring, there is a book written on this topic in the INVOCATION section of bash(1), but here's a snippet:
When bash is invoked as an interactive login shell, or as a non-inter- active shell with the --login option, it first reads and executes com- mands from the file /etc/profile, if that file exists. After reading that file, it looks for ~/.bash_profile, ~/.bash_login, and ~/.profile, in that order, and reads and executes commands from the first one that exists and is readable. The --noprofile option may be used when the shell is started to inhibit this behavior.
I am still stumped about this. I understand everything you are describing. My $SHELL is /bin/bash. The /etc/profile installed by Snow Leopard looks like this: # System-wide .profile for sh(1) if [ -x /usr/libexec/path_helper ]; then eval `/usr/libexec/path_helper -s` fi if [ "${BASH-no}" != "no" ]; then [ -r /etc/bashrc ] && . /etc/bashrc fi BUT My /etc/bashrc contains: export PATH="/usr/local/bin:/usr/local/sbin:/sbin:/bin:/usr/bin:/usr/sbin:/opt/X11/bin:/usr/local/mysql/bin:/usr/local/git/bin:/usr/libexec:." If I open an Apple terminal, then:
echo $PATH /usr/local/bin:/usr/local/sbin:/sbin:/bin:/usr/bin:/usr/sbin:/opt/X11/bin:/usr/local/mysql/bin:/usr/local/git/bin:/usr/libexec:.
If I edit ~/.xinitrc.d/99-wm.sh to run just an xterm, with no window manager, then in that xterm:
echo $PATH /opt/X11/bin:/usr/bin:/bin:/usr/sbin:/sbin
That is the problem. I don't have user-level files ~/.profile, ~/.bash_profile, or ~/.bash_login since I'm the only user of my laptop. But I shouldn't need to, if the shell is reading /etc/bashrc. When I copy /etc/bashrc to ~/.profile, etc, nothing changes. It is a launchd issue I think. Dave