-
-
Save edwelker/7843043 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RED=$'\e[31;40m' | |
BLUE=$'\e[0;34m' | |
D=$'\e[37;40m' # set this to what makes sense for your terminal color scheme | |
shopt -s histappend | |
pre_prompt() { | |
local exit_code=$?; | |
history -a; | |
history -n; | |
if [ ${exit_code} -eq 0 ]; then | |
local msg="OK" | |
echo "${BLUE}?=${exit_code} | ${msg}${D}"; | |
else | |
local msg=$(fortune -o -s -n 140) | |
echo "${RED}?=${exit_code} | ${msg}${D}"; | |
fi; | |
} | |
export PROMPT_COMMAND=pre_prompt | |
export HISTCONTROL=ignoredups:ignorespace |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment