From Bugzilla Helper: User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.10) Gecko/20050720 Fedora/1.0.6-1.1.fc3 Firefox/1.0.6 Description of problem: When I echo a command and pipe it to ssh everything normally works fine. However, when that command contains an 'exit' statement, I get this error: TERM environment variable not set. When I test using a set -x, it seem to be related to the "clear" command in .bash_logout. This applies to Fedora Core 3, RHES3, and RHES4 but NOT RHES2.1. Version-Release number of selected component (if applicable): openssh-3.9p1-8.RHEL4.4 bash-3.0-19.2 How reproducible: Always Steps to Reproduce: 1. echo 'exit 0' | ssh -T localhost Actual Results: [doughnut@shoe ~]$ echo 'exit 0' | ssh -T localhost TERM environment variable not set. [doughnut@shoe ~]$ echo 'set -x ; exit 0' | ssh -T localhost + exit 0 ++ clear TERM environment variable not set. [doughnut@shoe ~]$ Expected Results: Commands that don't involve exit work like expected: [doughnut@shoe ~]$ echo 'set -x ; sleep 0' | ssh -T localhost + sleep 0 [doughnut@shoe ~]$ Additional info: Our RHES2.1 box works fine. The clear is there, but no warning: [doughnut@shoe ~]$ echo 'set -x ; exit 0' | ssh -T brie + exit 0 ++ clear [doughnut@shoe ~]$
The difference between RHEL2.1 and newer releases are probably in that the warning was not issued by the clear program in the older release. However it doesn't make much sense to run the clear binary anyway. Use: echo "set -x; exit 0" | ssh localhost bash This way the bash invoked from ssh is not a login shell and the unnecessary clear command is not issued when exiting.