4

My prompt is such:

PS1="\[\033[32m\]\u@myserver\n\[\033[33m\w$\033[0m\] "

So as output after I ls i see this:

jake@myserver
~/public_html$
~/public_html$

When I should only (I think) see:

jake@myserver
~/public_html$

The color commands work (beautifully) but this duplicate line thing is driving me nuts. I adapted this command prompt from the one that comes with MySysGit for windows.

Why is this happening?

If I just hit enter at the prompt, it prints correctly, without the duplicate second line. The duplication only happens after ls, cd or maybe some other bash commands.

Jake
  • 845

1 Answers1

5

I don't see the doubling, but you're missing two escaped brackets:

PS1="\[\033[32m\]\u@myserver\n\[\033[33m\]\w$\[\033[0m\] "

You might also see if PROMPT_COMMAND has a value. It may be producing some output. This will tell you what it's set to:

echo $PROMPT_COMMAND

Without knowing what it contains, I can't tell you what to do about it if it is part of the problem. However, you can clear it like this:

PROMPT_COMMAND=

That's nothing after the equal sign.