Fix prompt for commands over SSH

When executing commands over SSH, such as SCP, the server (tput)
complains that there is no terminal defined. This fix sets the T_*
variables only if the TERM variable is not empty.