user prompt:
user - / :
up/down keys to locate historical commands.
user - / : historical command
clear the “historical command” :
user - / :hist
No matter how many times I hit BackSpace.. unable to delete “hist” part.
technically it is not even there. but on the screen it simply wont clear out until I hit “enter”
user - / :hist user - / :
what causes it ?
The problem is probably due to the colors I used here. but how can It be corrected ?
PS1="\[\033[38;5;190m\]\u - \W : \e[m"
Answer
Your final ANSII escape sequence isn’t finished. The reset code (\e[0m
), like the others, needs a [
. Change your PS1
to:
PS1="\[\033[38;5;190m\]\u - \W : \[\e[0m"
Or, to keep things consistent:
PS1="\[\033[38;5;190m\]\u - \W : \[\033[0m"
Attribution
Source : Link , Question Author : VIE , Answer Author : terdon