In article <[EMAIL PROTECTED]>,
Martin Costabel <[EMAIL PROTECTED]> wrote:
> 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.
To continue the example with rsync, if I do something like this:
% #rsync -avz --inplace --progress --stats --rsh=ssh /directory
2nd.local:/directory
then the rsync used on 2nd is /usr/bin/rsync rather than /sw/bin/rsync.
On the other hand, if I manually invoke rsync on 2nd, since /sw/bin is
before /usr/bin in the $PATH, /sw/bin/rsync is used.
As far as I can tell the reason for this is that when I use rsync from
1st it invokes a non-interactive shell on 2nd. Furthermore, I don't use
bash, I use tcsh (however, I am slowly moving to zsh but that is another
discussion) and tcsh reads its startup scripts in this order (if they
exist):
a. ~/.tcshrc
b. /usr/share/tcsh/examples/rc
c. /usr/share/tcsh/examples/tcsh.defaults
d. /usr/share/tcsh/examples/environment
e. ~/Library/init/tcsh/environment.mine
f. ~/Library/init/tcsh/rc.mine
g. /usr/share/tcsh/examples/aliases
h. ~/Library/init/tcsh/aliases.mine
i. /usr/share/tcsh/examples/completions
j. ~/Library/init/tcsh/completions.mine
1. ~/.login
2. /usr/share/tcsh/login
3. ~/Library/init/tcsh/path
4. ~/Library/init/tcsh/login.mine
5. /sw/bin/init.csh
everything from ~/.login and below is not read for non-interactive
shells. Fine, let's source /sw/bin/init.csh from e.g., (e)
environment.mine - however this breaks login-/interactive-shells because
in (2) login the following clause is included:
set path = ( \
~/bin \
/usr/local/bin /usr/bin /bin \
/usr/local/sbin /usr/sbin /sbin \
)
> 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.
Do you have a link to such a discussion? I have been unable to find
them. Maybe an addition to the FAQ would be motivated?
Anyway, how do you recommend that I set up my startup scripts so that
the right version of e.g., rsync is used in situations as the one I
described above?
-------------------------------------------------------
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://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
Fink-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/fink-users