
Meine Bash-Eingabeaufforderung löscht sich selbst, wenn der nachfolgende Text gelöscht wird oder ich im Verlauf zu weit gehe.
Beim Anmelden sieht die Eingabeaufforderung normal aus. Es gibt weiße Klammern um einen farbigen Benutzernamen und dann ein weißes > als Eingabeaufforderung. Wenn ich jedoch in meinem Verlauf zweimal nach oben gehe, überschreibt der Verlaufsbefehl meine Eingabeaufforderung:
[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
Es passiert auch, wenn ich den Befehl lösche:
[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
Die Zeilen in der Bashrc, die dies wahrscheinlich beeinflusst haben könnten, sind:
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
Antwort1
Nun, ich habe einen Weg gefunden, das Problem zu umgehen:
PROMPT_COMMAND=prompt
wurde geändert in:
PROMPT_COMMAND='PS1=`prompt`'
Edit: und die Farben wurden eingewickelt in \[ \]
(dh color='\[\e[0;32m\]'
)