Server Bash Line Wrapping Over Text & In Wrong Place

Solution 1:

The custom prompt is the issue (from your comments).

PS1='\e[1;32m\u@\h\e[m:\e[1;34m\w\e[m$ '

It's either sending a control sequence your terminal doesn't understand or it's not well formed.

You could try this,

PS1='\[\e[1;32m\]\u@\h\[\e[m\]:\[\e[1;34m\]\w\[\e[m\]$ '

Solution 2:

This is almost certainly a difference of opinion between your terminal emulator and running system regarding terminal capabilities. If, as you say, it only happens on certain machines (or only over SSH), compare the value of the TERM environment variable between working and non-working systems, and attempt to set TERM appropriately on the system that isn't working.

This may not work, depending on how old the terminfo database is on the system that isn't working; it's possible that you'll need to upgrade that system, or at the very least find another TERM value that works for you and that the remote system knows about.

Solution 3:

I was facing the same problem. I went into Terminal's "Preferences" in Lion (latest OSX 10.7.3) and then into:

Settings --> Advanced --> "Declare terminal as"

And chose "xterm" instead of the original V100.

Problem solved.

(This is because I love my custom prompts etc..)