* Gokdeniz Karadag on Saturday, July 12, 2008 at 03:10:00 +0300
Setting the following in all machines achieves what I want, it sets
screen title to hostname,
PROMPT_COMMAND='echo -n -e "\033k${HOSTNAME}\033\\"'
but when I connect to the machine out of screen, It prints the hostname
literally, so the prompt becomes like "hostname address@hidden $ " , which is
ugly and redundant.
To ensure that only ssh sessions within a GNU screen get the "title setter
prompt command", environment variables are useful, I can use the TERM variable,
but in stable debian, the default TERM=screen breaks vim editor, it goes crazy
when you press home, or pageup buttons. Using TERM=xterm fixes this, so I
cannot check for TERM being equal to "screen".
Does checking for $STY work for your purposes?
if [ -n "$STY" ]
<screen specific stuff>
fi
c