Your ICT partner

scp or rsync login failure due to echo in .bashrc

How to fix a scp or rsync failure due to an echo in .bashrc?

Did you ever had the following issue with scp:

protocol error: unexpected <newline>

Or with rsync:

rsync error protocol incompatibility

Well, it happened to us and the reason is an echo command in the ~/.bashrc file!

There are two ways to fix it:

  1. remove the echo command, but it was there on purpose, right?
  2. Add the following section to your ~/.bashrc file:
if [[ $- != *i* ]] ; then
  # shell is non-interactive - do a silent return
  return
fi

And, the problems go away. Neat trick, no?


« How to renew an expired key of Ubuntu repository |  »

Comments

comments powered by Disqus