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.


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.

1 Answer 1


This one looks like your 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:

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
        echo This shell is interactive

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 ;;
  • This output problem is totally new to me. Furthermore, fortune-mod has been spitting out fortunes from /etc/bashrc since fink was born, and scp never output it. Nevertheless, I think your advice is sage and I'll take it. Thanks!
    – msanford
    May 12, 2011 at 20:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .