Why does "echo'' " in /etc/bashrc cause scp to hang?

Solution 1:

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