こんな感じで書いてる
if [[ "$TERM" =~ ^xterm ]] || [[ "$TERM" =~ ^tmux ]];then
prompt_command() {
local exit_status=$?
if [ "$exit_status" -ne 0 ]; then
PS1='\[\e[41m\]\[\e[33;04m\]\u@\h\[\e[00m\]:\[\e[32m\]\w\[\e[00m\]\$ '
else
PS1='\[\e[00m\]\[\e[33;04m\]\u@\h\[\e[00m\]:\[\e[32m\]\w\[\e[00m\]\$ '
fi
}
PROMPT_COMMAND=prompt_command
bind C-K:previous-history
bind C-l:clear-screen
alias egrep='egrep --color=auto'
alias grep='grep --color=auto'
alias ls='ls --color=auto --time-style=+%Y/%m/%d_%H:%M:%S'
fi
AIに色々聞いて改善されてる