In my bashrc file I have my prompt set as follows:
TC_GRE="^[[0;32;40m"
TC_RESET="^[[0m"
PS1="${TC_GRE}i:${TC_RESET}"
The prompt therefore is simply a green "i:". When I work in my shell and I scroll up in the history my command line messes up. Consider the following:
i: shell_command_one
i: shell_command_two
i: shell_command_three
Now when I go up in my history the line might look something like this:
i: shell_comshell_command_two
If I hit enter on that it executes shell_command_two. (Notice how the shell_com is just junk characters on the terminal.
I suspect it might have something to do with the color characters being non-printing. Does anyone know how to fix this in bash?
p.s. I'm not sure if this is better posted on superuser but I thought it might be best here since its about bash scripting.
Best Answer
It appears you have a malformed CSI color code. Try this in your
.bashrc
file: