How do I make OS X set the terminal title back to the original title when coming back from ssh?
Adding
export PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD/$HOME/~}\007"'
to my .bash_profile
fixed the problem.
It appears as if the string in PROMPT_COMMAND
gets executed every time the prompt is displayed. From the man page:
PROMPT_COMMAND
If set, the value is executed as a command prior to issuing each primary prompt.