[Xquartz-dev] 2.3.2_rc4

Harald Hanche-Olsen hanche at math.ntnu.no
Tue Dec 23 11:33:08 PST 2008


+ Martin Costabel <costabel at wanadoo.fr>:

> As I repeatedly said, bash does *not* load its startup scripts if 
> run after "exec -l" or after /usr/bin/login. It is correctly 
> executed with the name "-bash", but it does not start up as a login 
> shell. Whether this is a bug in Apple's version of bash, I don't 
> know, but this is how it behaves.

It is in fact the documented behaviour. See the INVOCATION section in 
the bash man page:

       When  bash is invoked as an interactive login shell, or as a 
 non-interactive shell with the --login option, it first reads and 
 executes  commands  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.

According to the definitions that I did not quote, when bash is run 
with argument zero equal to -bash it is a login shell, however it is 
not interactive and so it doesn't read the login files unless you 
also supply --login.

To make life even more interesting, csh doesn't recognize the -l flag 
if it also given the -c flag.

I think this combination of facts destroys any hope of a single 
method for doing what we are trying to do and which works with both 
bash and csh.

- Harald


More information about the Xquartz-dev mailing list