4 added 184 characters in body
source | link

What's going on is that Bash is getting confused about the number of printing characters in your prompt. It sends cursor positioning sequences to the terminal to position the cursor properly for doing command history and such. It needs to have a good idea of where the cursor actually is after printing the prompt.

Try setting your prompt to this:

PS1='\[\e[35m\][\W]:\[\e[0m\] '

It should now work as expected.

The \[ and \] pairs tell Bash that the stuff between them is a non-printing escape sequence and won't actually move the cursor forward. It will then correctly guess the cursor position and do a proper replacement when going through your command history.

This information can be found in the info node (bash)Printing a Prompt.

Edit: In newer versions of bash this has changed to (bash)Controlling the Prompt.

What's going on is that Bash is getting confused about the number of printing characters in your prompt. It sends cursor positioning sequences to the terminal to position the cursor properly for doing command history and such. It needs to have a good idea of where the cursor actually is after printing the prompt.

Try setting your prompt to this:

PS1='\[\e[35m\][\W]:\[\e[0m\] '

It should now work as expected.

The \[ and \] pairs tell Bash that the stuff between them is a non-printing escape sequence and won't actually move the cursor forward. It will then correctly guess the cursor position and do a proper replacement when going through your command history.

This information can be found in the info node (bash)Printing a Prompt.

What's going on is that Bash is getting confused about the number of printing characters in your prompt. It sends cursor positioning sequences to the terminal to position the cursor properly for doing command history and such. It needs to have a good idea of where the cursor actually is after printing the prompt.

Try setting your prompt to this:

PS1='\[\e[35m\][\W]:\[\e[0m\] '

It should now work as expected.

The \[ and \] pairs tell Bash that the stuff between them is a non-printing escape sequence and won't actually move the cursor forward. It will then correctly guess the cursor position and do a proper replacement when going through your command history.

This information can be found in the info node (bash)Printing a Prompt.

Edit: In newer versions of bash this has changed to (bash)Controlling the Prompt.

3 link to manual
source | link

What's going on is that bashBash is getting confused about the number of printing characters in your prompt. It sends cursor positioning sequences to the terminal to position the cursor properly for doing command history and such. It needs to have a good idea of where the cursor actually is after printing the prompt.

Try setting your prompt to this:

PS1='\[\e[35m\][\W]:\[\e[0m\] '

It should now work as expected.

The \[ and \] pairs tell bashBash that the stuff between them is a non-printing escape sequence and won't actually move the cursor forward. It will then correctly guess the cursor position and do a proper replacement when going through your command history.

This information can be found in the info node (bash)Printing a Prompt(bash)Printing a Prompt.

What's going on is that bash is getting confused about the number of printing characters in your prompt. It sends cursor positioning sequences to the terminal to position the cursor properly for doing command history and such. It needs to have a good idea of where the cursor actually is after printing the prompt.

Try setting your prompt to this:

PS1='\[\e[35m\][\W]:\[\e[0m\] '

It should now work as expected.

The \[ and \] pairs tell bash that the stuff between them is a non-printing escape sequence and won't actually move the cursor forward. It will then correctly guess the cursor position and do a proper replacement when going through your command history.

This information can be found in the info node (bash)Printing a Prompt.

What's going on is that Bash is getting confused about the number of printing characters in your prompt. It sends cursor positioning sequences to the terminal to position the cursor properly for doing command history and such. It needs to have a good idea of where the cursor actually is after printing the prompt.

Try setting your prompt to this:

PS1='\[\e[35m\][\W]:\[\e[0m\] '

It should now work as expected.

The \[ and \] pairs tell Bash that the stuff between them is a non-printing escape sequence and won't actually move the cursor forward. It will then correctly guess the cursor position and do a proper replacement when going through your command history.

This information can be found in the info node (bash)Printing a Prompt.

2 added 3 characters in body
source | link

What's going on is that bash is getting confused about the number of printing characters in your prompt. It sends cursor positionpositioning sequences to the termainlterminal to position the cursor properly for doing command history and such. It needs to have a good idea of where the cursor actually is after printing the prompt.

Try setting your prompt to this:

PS1='\[\e[35m\][\W]:\[\e[0m\] '

It should now work as expected.

The \[ and \] pairs tell bash that the stuff between them is a non-printing escape sequence and won't actually move the cursor forward. It will then correctly guess the cursor position and do a proper replacement when going through your command history.

This information can be found in the info node (bash)Printing a Prompt.

What's going on is that bash is getting confused about the number of printing characters in your prompt. It sends cursor position sequences to the termainl to position the cursor properly for doing command history and such. It needs to have a good idea of where the cursor actually is after printing the prompt.

Try setting your prompt to this:

PS1='\[\e[35m\][\W]:\[\e[0m\] '

It should now work as expected.

The \[ and \] pairs tell bash that the stuff between them is a non-printing escape sequence and won't actually move the cursor forward. It will then correctly guess the cursor position and do a proper replacement when going through your command history.

This information can be found in the info node (bash)Printing a Prompt.

What's going on is that bash is getting confused about the number of printing characters in your prompt. It sends cursor positioning sequences to the terminal to position the cursor properly for doing command history and such. It needs to have a good idea of where the cursor actually is after printing the prompt.

Try setting your prompt to this:

PS1='\[\e[35m\][\W]:\[\e[0m\] '

It should now work as expected.

The \[ and \] pairs tell bash that the stuff between them is a non-printing escape sequence and won't actually move the cursor forward. It will then correctly guess the cursor position and do a proper replacement when going through your command history.

This information can be found in the info node (bash)Printing a Prompt.

1
source | link