Files
dotfiles/.bash_prompt
T

29 lines
514 B
Bash

#!/bin/bash
# History append
shopt -s histappend
# Prompt
set_prompt() {
local EXIT_STATUS=$?
local SUCCESS="\[\e[32m\]"
local ERROR="\[\e[34m\]"
local RESET="\[\e[0m\]"
history -a
history -c
history -r
if [ $EXIT_STATUS -eq 0 ]; then
local COLOR=$SUCCESS
else
local COLOR=$ERROR
fi
# PS1="[\u@\h \W]${COLOR}\\\$${RESET} "
PS1="[\u@\h \! \W]${COLOR}\\\$${RESET} "
if [ -n "$SSH_CONNECTION" ]; then
PS1="|\u@\h \! \W|${COLOR}\\\$${RESET} "
fi
}
PROMPT_COMMAND=set_prompt