# meant to be sourced from your bash environment # this will display a colored error code if the previous function # returned an error, or just the regular prompt otherwise. # # JPM showIfError () { AUX=$?; if [ $AUX -gt 0 ]; then PREFIX="\[\033[1;33m\][${AUX}] "; else PREFIX=""; fi PS1="${PREFIX}\[\033[1;32m\]\w\[\033[0;0m\]\$ "; } PROMPT_COMMAND=showIfError