3

My prompt is working fine withing a normal bash terminal, but it appears broken (or it shows broken) in an ansi-term emacs bash terminal.

This is my PS1:

\[\e[00;31m\]\u\[\e[00;33m\]@\h\[\e[00;32m\] \W\[\e[1;34m\] $\[\e[0m\]

And it looks like this in a normal bash: Normal Prompt

And this is how it looks in emacs ansi-term (bash): Broken Prompt emacs

I have already checked that default-process-coding-system variable is (utf-8-unix . utf-8-unix)

I think I need to escape something in my prompt, but I can't figure out what.

EDIT:

I have tried to simplify it, by executing export PS1='a' and I still have that garbage (0;mbax2ct2@kilburn:~/directory) in front of the prompt. any more ideas? I am actually logged into that machine through ssh; would it be possible that this actually does something else with the PS1 after I set it?

Ciprian Tomoiagă
  • 3,773
  • 4
  • 41
  • 65
  • 1
    It looks like your PS1 may have more in it that you've posted as your second picture shows two different paths which suggests that there may be something that attempts, for instance, set xterm title bar. In any case, there may already be an answer on SO: http://stackoverflow.com/questions/17579662/shell-prompt-repeating-when-using-ssh-in-ansi-term – ArtemB Nov 14 '13 at 03:04
  • this is all that is in my .bashrc for PS1; I am not sure, however, if all the escape characters are correct. they are supposed to be just colors: red, yellow, green, bold blue, default (white?) – Ciprian Tomoiagă Nov 15 '13 at 10:00

1 Answers1

2

Check whether you have anything set for the PROMPT_COMMAND environment variable.

Clear it with unset PROMPT_COMMAND and I suspect you will stop seeing the unexpected behavior.

Zach
  • 1,263
  • 11
  • 25