If you want that screen
prints its session name on the PuTTY window title add this function to your .bashrc
:
screen () { sessionname=$(echo $@ | fgrep -- '-S ' | sed 's/.*-S \([^ ]\+\).*/\1/'); echo -ne "\033]0;$\007"; command screen $@; echo -ne "\033]0;Putty\007" }
Run screen as usual.
The function checks for an option called -S, extracts the session name, sets it with terminal escape sequences (or sets Putty if session name is empty) and runs the screen
binary. When the screen
binary exits, the PuTTY window title is reset to Putty.
Since seeing is believing :-) :
This is a Putty session ready to execute screen.
Inside a screen session. Notice the PuTTY window title.
Screen session ended. Title is reset.