Reputation: 424
When I use the up arrow key to scroll through my command history in bash, I'm frequently, but not always, ending up with the first three characters of the command getting stuck essentially.
For example, I type the following commands (in this order):
>whoami
>pwd
>ls -la
Now I hit up once and get:
>ls -la
I hit it a second time and get
>ls pwd
I hit it an third time and get
>ls whoami
If I then hit down a couple times, I get
>ls ls -la
and if I go all the way down i just get
>ls
If I hit enter here, it does behave as if there's nothing there (rather than the extra ls)
What could be causing this/where should I be looking? I'm still mostly a linux newb.
Upvotes: 4
Views: 775
Reputation: 424
Figured this out. The problem was with the location of a \n in my PS1 prompt.
The bad version:
export PS1="\n\e[0;33m[\!]\e[m\e[0;32m[\A \w]\n\e[m>
The good version:
export PS1="\n\e[0;33m[\!]\e[m\e[0;32m[\A \w]\e[m\n>
Upvotes: 2