I would like to configure the terminal type by detecting it. For example when I am connecting to a Solaris box with PuTTY, the $TERM variable is set to vt100. I would like to negotiate this so, when the terminal emulator is PuTTY, to set $TERM to xterm.

I've noticed that at ^E PuTTY answers back with PuTTY. But I think that the best method is to use tput to try to detect the terminal emulator type. The problem is that I could not find any reference in the terminfo or tput manual how to do this.

Otherwise I will try with something based on:

unset remote_term;echo $'\cE';read -rt 1 -n5 remote_term ;echo remote_term=$remote_term
link|improve this question

80% accept rate
feedback

1 Answer

Any reason why you can't just set the connection options in PuTTY to negotiate the desired terminal type?

Under PuTTY configuration, Click Connection -> Data, and then set the "Terminal-type string" in the Terminal Details section to whatever terminal type you want. Mine is set to ansi but you can easily change that to xterm.

This is more elegant than intercepting the Ctrl-E answerback as it respects the user's intent for the terminal type.

link|improve this answer
The environment is a shared between multiple teams and they are using different terminal emulators. Sometimes serial console. PuTTY is just an example. – Mircea Vutcovici Jan 26 at 23:18
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.