Skip to content

Instantly share code, notes, and snippets.

@edwelker
Forked from mbbx6spp/gist:5622645
Created December 7, 2013 14:39
Show Gist options
  • Save edwelker/7843043 to your computer and use it in GitHub Desktop.
Save edwelker/7843043 to your computer and use it in GitHub Desktop.
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