[Xquartz-dev] 2.3.2_rc4

Martin Costabel costabel at wanadoo.fr
Tue Dec 23 14:39:30 PST 2008


Cameron Simpson wrote:
[]
>> If run without the flag, it does not load the bash startup scripts.
>> 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. You have to use "bash --login" to have it read its startup
>> scripts.
> 
> Can you specify a little more here? Can you verify (maybe by putting a
> few echo statements in files) that it does not run the .bash_profile nor
> .profile files? Meanwhile, I'll test that myself here too.
> 
> Your assertion seems not to hold here:
> 
>   [/Users/cameron]fleet*> cat .bash_profile
>   echo BASH PROFILE
>   [/Users/cameron]fleet*> bash --login
>   BASH PROFILE
>   fleet:~ cameron$ exec -l /bin/bash
>   BASH PROFILE
>   fleet:~ cameron$ exit
>   logout
> 
> It seems to work just fine, which is expected since that's what login
> does as well.

I think Harald got the right interpretation out of the bash man page, 
which also corresponds to my observation: "exec -l" runs the login 
startup scripts only if you are starting an interactive shell. This is 
what you are doing when you run the "exec -l" command from the command 
line. If you run it inside a script with the additional -c flag, it does 
not read the login startup scripts; nor any other startup script, for 
that matter.

And yes, I have markers in all my shell startup scripts: They add their 
name to the environment variable "RC". So by running "printenv RC", I 
know which scripts had been run in which order. For example, with my 
current X11 wrapper script, I see in the initial xterm

costabel% printenv RC
MacOSX_environment.plist:/etc/profile:~/.profile:/A/U/X11:/etc/csh.cshrc:rc.mine:/etc/csh.login:path:/etc/csh.cshrc:environment.mine:rc.mine

There are a couple of scripts there which show that I am still using 
Fred Sanchez' wonderful tcsh configuration scripts that Apple shipped 
with OSX 10.0 (and which are still sitting in /usr/share/tcsh/examples/).

-- 
Martin




More information about the Xquartz-dev mailing list