Alexander K. Hansen wrote:
On 1/13/06, david <[EMAIL PROTECTED]> wrote:
Why does Fink recommend that I set the path in files that only are read
when I do an interactive login?

I have installed, for example, fink's rsync but if I use the default
setup for fink the rsync included in Mac OS X is used for
non-interactive sessions rather than the fink version.

What examples of "non-interactive sessions" do you have in mind? I don't even know what this is, "session" sounds pretty interactive to me. Anyway, the distinction is not between interactive and non-interactive, but between login and non-login shells. Interactive/non-interactive concerns the question whether stdin and stdout are connected to terminals. Login/non-login concerns the question of reading startup scripts. PATH is usually set in a login shell, and /sw/bin/init.sh is sourced in login shells.

Why is it setup like this? It doesn't make sense in my eyes.

Googling didn't come up with an explanation so I appreciate any input.


Good question.  I don't know the answer.  ;-)  I actually set my
environment in .bashrc, so that non-interactive operations (e.g.
X11.app) know about it.

Since when is X11.app non-interactive? The fact that Apple ships it with a bad configuration and it doesn't read the right startup files is perhaps a reason to try some ugly hacks, but it shouldn't be a reason to obliterate the distinction between login and non-login shells in general. Or between interactive and non-interactive shells, for that matter: As "man bash" explains, ~/.bashrc is read by *interactive* shells that are not login shells. If you start a non-interactive, non-login shell, then by default *no* startup script is read at all.

This has been discussed many times, and I know that some people are not convinced, but I still think it is wrong to source /sw/bin/init.sh automatically in every subshell. After all, you start your subshell always inside an interactive environment, and environment variables like PATH are meant to be transmitted to subshells, so it is sufficient to run /sw/bin/init.sh once at startup (hence "login") of the interactive environment in which your non-login shell is started. If you need a different environment in your subshell, then define it there.

--
Martin



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
Fink-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/fink-users

Reply via email to