On Tue, Apr 26, 2011 at 11:07 AM, Aurélien Aptel <aurelien.ap...@gmail.com> wrote: > # the \$(cmd) in PS1 is probably bash-only > # maybe PROMPT_COMMAND is more portable > PS1="\$(dirbg)\u \w $"
It seems you need to enclose non-printing characters in \[\] on bash and %{%} on zsh. So for bash: PS1="\[\$(dirbg)\] \u \w $ " For zsh you have to setopt promptsubst in order to substiture \$(cmd), so: setopt promptsubst PS1="%{\$(dirbg)%}%n %~ $ " Voilà. It works on urxvt and xterm, for the rest YMMV.