Why does "echo'' " in /etc/bashrc cause scp to hang? I am copying directories from a Snow Leopard machine to a Tiger machine using scp -r and for some reason, it appears that the final line of the target (Tiger) machine's /etc/bashrc (echo '') causes scp to hang. When commended out, it works as expected.

Why?

I've never seen this behaviour on any of my Slackware, Ubuntu, Gentoo, SuSE, Mandrake or even Apple machines. Is this part of a recent 10.6 security update? scp worked as expected with that line until recently.
This one looks like your issue:


Forum Post about the issue


You really shouldn't output stuff in your profile unless you are going in interactively.  It appears that SCP is sensitive to it (potentially, depending on a lot of factors, I'm sure).  You can test for interactivity thusly:


bashrc interactive test


Text copied out for reference:

To determine within a startup script whether Bash is running 
interactively or not, examine the variable $PS1; it is unset in non-
interactive shells, and set in interactive shells. Thus:

if [ -z "$PS1" ]; then
        echo This shell is not interactive
else
        echo This shell is interactive
fi

Alternatively, startup scripts may test the value of the `-' special 
parameter. It contains i when the shell is interactive. For example:

case "$-" in
*i*)    echo This shell is interactive ;;
*)  echo This shell is not interactive ;;
esac