Improve SSH pty de-garbling.

Empty out PROMPT_COMMAND too. Deal with common PROMPT_COMMAND output
before setting PROMPT_COMMAND.