1
As you can see in the screenshot, I have an unneeded newline character in my prompt. Anyone know how to do remove this character from my prompt?
1
As you can see in the screenshot, I have an unneeded newline character in my prompt. Anyone know how to do remove this character from my prompt?
4
This "new line character" is part of your Bash prompt, kept in the $PS1
variable:
PS1='\[\e]0;\w\a\]\n\[\e[32m\]\u@\h \[\e[33m\]\w\[\e[0m\] \$ '
Remove it and put the updated PS1 in your ~/.bashrc
.
See Customizing bash prompt for further information.
That's great!, how do you my PS1 having the \n? – Kit Ho – 2012-01-19T01:10:09.100
@Kit: I guessed. – user1686 – 2012-01-19T09:12:30.957
Then stop pressing Enter? – Ignacio Vazquez-Abrams – 2012-01-18T10:55:13.177
-1, this is not a diagram, and this question means nothing. – Ravachol – 2012-01-18T11:01:26.517
Can you explain a bit more about what you mean? – Paul – 2012-01-18T11:01:34.857
@Ravachol Please use comments to provide constructive guidance to help the OP provide enough information – Paul – 2012-01-18T11:04:00.690
1
The thing is that the questioner knows the answer to the question as it is asked. Xe stated it in this almost identical question that xe asked three hours earlier.
– JdeBP – 2012-01-18T17:45:08.673@JdeBP: the problem is not the same as before. this one a extra newline character is generated when I press "Enter". But before, it is a new line character in the PS1 – Kit Ho – 2012-01-18T23:56:20.590
@KitHo: Your prompt is printed when you press "Enter". That's where the new-line character is coming from. What is the output of
echo "$PS1"
? Incidentally, your screenshot is difficult to read; I had to download a copy of the image to see the extra empty lines clearly. A textual copy-and-paste would have demonstrated the problem more clearly. – Keith Thompson – 2012-01-19T00:55:42.183