/etc/skel/.bashrc states that: # This file is sourced by all *interactive* bash shells on startup. This # file *should generate no output* or it will break the scp and rcp commands. It is also sourced by some non-interactive shells, and CAN generate output, although it is advised not to do so. Will not break the scp command - not checked rcp. Ciaran McCreesh (Gentoo Dev) verified this fact. Reproducible: Always Steps to Reproduce: 1. cat /etc/skel/.bashrc Actual Results: Showed the file... Expected Results: Change default to: # This file is sourced by bash in most normal login situations. This file # *should not generate any output* however, little will break if you do. I'm a student. Oh how Christmas holidays bore me so... Happy New 2005 Gentoo Devs!
The comment is not perfect, but pretty close. If you generate output from .bashrc, you should do it after a test for interactivity (by checking for PS1 or "i" in $- as explained in the bash man-page) Currently in portage, the comment is: # This file is sourced by all *interactive* bash shells on startup, # including some apparently interactive shells such as scp and rcp # that can't tolerate any output. This isn't perfect since some versions of scp can tolerate output, but it's close enough, IMHO. I believe there are older versions of scp that will break if .bashrc generates output without a prior test for interactivity.
i have broken my scp's in the past because my .bash files would run `screen -list` without checking to see if $TERM was "dumb" or not scp would fail w/out error and/or any output, was quite annoying to track that bug down :)