Batch mode SSH gives error "TERM environment variable not set"

linux, ssh

Solution

Use `-t` option to ssh; it allocates tty.

 -t      Force pseudo-tty allocation.  This can be used to execute arbitrary
         screen-based programs on a remote machine, which can be very useful,
         e.g. when implementing menu services.  Multiple -t options force tty
         allocation, even if ssh has no local tty.

Problem

I made sure that TERM was defined in the .bashrc. However, when running ssh in batch mode I get: ``` $ ssh pc-lab7 "echo $TERM; echo $0" TERM environment variable not set. linux -bash ``` If I run ssh in interactive mode, I do not see this error. How can I eliminate this error message?

Original source