
Приглашение Bash очищается само по себе, если удалить текст после него или зайти слишком далеко в историю.
При входе в систему приглашение выглядит нормально. Вокруг цветного имени пользователя есть белые скобки, а затем белый > в качестве моего приглашения, однако если я дважды перемещаюсь вверх по своей истории, команда истории перезаписывает мое приглашение:
[stonewareslord] > #Initial prompt. stonewareslord is green
| Cursor is above this pipe symbol
[stonewareslord] > ls #Up arrow pressed once. ls was my last command. Colors are normal, ls is white
| Cursor is above this pipe symbol
pwdonewareslord] > ls #Up arrow a second time. pwd overwrite [st. pwd is white and the other colors are normal.
| Cursor is above this pipe symbol
Это также происходит, когда я удаляю команду:
[stonewareslord] > ls #Typed command after initial prompt. stonewareslord is green
| Cursor is above this pipe symbol
[stonewareslord] > l #Deleted one character
| Cursor is above this pipe symbol
#Deleted second character (line is blank). Anything I type is white
| Cursor is above this pipe symbol
Строки в bashrc, которые, вероятно, могли на это повлиять:
color='\e[0;32m' #Green
reset='\e[0m' #Color is set back to normal (white)
prompt(){
printf "[$color%s$reset]>" `whoami`
}
PS1=""
PROMPT_COMMAND=prompt
export HISTFILESIZE=
export HISTSIZE=
export HISTTIMEFORMAT="%Y-%m-%d_%H:%M:%S "
export HISTFILE=~/.bash_eternal_history
readonly HOME
readonly HISTIGNORE
решение1
Ну, я придумал, как это обойти:
PROMPT_COMMAND=prompt
было изменено на:
PROMPT_COMMAND='PS1=`prompt`'
Редактировать: и цвета были завернуты в \[ \]
(т.е. color='\[\e[0;32m\]'
)