Re: Bash login shells with X11 (executing .bash_profile, .bashrc)
Re: Bash login shells with X11 (executing .bash_profile, .bashrc)
- Subject: Re: Bash login shells with X11 (executing .bash_profile, .bashrc)
- From: Randy Ford <email@hidden>
- Date: Fri, 7 Feb 2003 14:57:34 -0600
On Friday, February 7, 2003, at 11:11 AM, Lawrence You wrote:
At 10:29 AM +0100 2/7/03, kristian ragndahl wrote:
On Thu, 6 Feb 2003, Lawrence You wrote:
Has anyone been able to get .bash_profile to be executed without
having to specify "xterm --login"? When I start up an xterm from the
X11 Beta, .bash_profile doesn't get run at any time.
I put this in my ~/.Xdefaults;
XTerm*.LoginShell: True
Thanks for this and the other responses. I use .Xdefaults for other
programs but it didn't occur to me to try to set the resource for
xterm. I can't remember ever having to set xterm for login before.
That works.
I was going to say that this behavior seems like a bug, i.e. that at
some point, I'd assume that you would have "logged in" and the script
would be executed. Since the login on Mac OS X is not shell-based,
that assumption is wrong (and for the vast majority of Mac OS X users,
a behavior they probably don't want or need). I think it would be nice
for the X11 application to assume that it is taking care of the
"login" step, albeit without any kind of authentication.
I think it's definitely a bug, and setting xterm to always invoke a
login shell is not an acceptable workaround for most people. A lot of
times I'll want to invoke another xterm with my current environment. I
might be working on a project where I've temporarily added a project
directory to my path. If I launch an xterm, I expect the shell to
inherit everything from the current shell.
I also have a guard variable in my .profile to ensure that code that
does things like add to the current path does not get executed more
than once. It slows things down and can lead to other errors if the
PATH or MANPATH keep getting appended. They will only be altered in my
case if my guard variable has not been set. However, if I invoke xterm
as a logging shell, it invokes /etc/profile, which resets the path.
Then, when my .profile is invoked, the path doesn't get fixed because
my guard variable is still set. However, my MANPATH variable is not
reset by /etc/profile, so it does is correct. If I don't use the guard
variable, the MANPATH (and other things) will repeatedly be altered.
The real bug is that the X11.app doesn't start with a login shell. If
it invoked the users default shell as a login shell, then the default
xterm (if no .xinitrc) and everything launched by the Application menu
would have the correct environment. That would also fix the problem
that the .xinitrc doesn't get launched with a proper environment. In
my view, the current method is seriously broken.
My workaround is to explicitly source ~/.bash_profile before each
command in the Application menu:
. ~/.bash_profile;xterm
Then, if I invoke another xterm from the shell, or if I display an
xterm from another system on my machine, it does not invoke a login
shell. Note that to be complete, I could source /etc/profile before
~/.bash_profile, but my /etc/profile only sets the initial path anyway.
This bug has generated a lot of questions on this list, but it's
probably a fairly minor annoyance to most people. However, for people
like me who use the shell heavily, it's a real pain. Apple needs to
fix it before the next release.
randy.
_______________________________________________
x11-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/x11-users
X11 for Mac OS X FAQ: http://developer.apple.com/qa/qa2001/qa1232.html
Report issues, request features, feedback: http://developer.apple.com/bugreporter
Do not post admin requests to the list. They will be ignored.