The default PROMPT_COMMAND screws up for a directory name ending in a slash: [root@emcee root]# set -x ++ echo -ne '\033]0;root@emcee:~\007' [root@emcee root]# cd /local/jorton/php/scratch/a\\/ + cd '/local/jorton/php/scratch/a\/' ++ echo -ne '\033]0;root@emcee:/local/jorton/php/scratch/a\\007' because it escapes the \, thereby preventing the \007 from being printed and terminating the escape sequence. Subsequently shell output is broken until a real \007 is printed. Maybe that gun was pointing at *my* foot...
I've reproduced this bug and found a solution, i'm just not sure i'm really happy with it as it splits the PROMPT_COMMAND in 2 parts: instead of doing: PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME%%.*}:${PWD/#$HOME/~}\007"' using this works: PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME%%.*}:${PWD/#$HOME/~}"; echo -ne "\007"' This might be a problem as a user could press CTRL-C exactly at the time the first echo stops, possibly causing the same deranged output again. Read ya, Phil
Oh, i'll include the fix in the next version. It surely can't be worse then it already was, so if a user willfully tries to break the prompt now there's nothing i can do about it (except maybe not using PROMPT_COMMAND at all, but thats for a later date...). Read ya, Phil