25 lines
448 B
Bash
25 lines
448 B
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} "
|
|
}
|
|
PROMPT_COMMAND=set_prompt
|