# # Set the prompt based on 1st arg, which if # invoked with $? will set it based on pass/fail # of the previous command. # based on work by Karl D. @ Lewis&Clark # promptcolor() { local X=32 if [[ $1 != "0" ]]; then X=31; fi printf "%s" "\[\e[01;${X}m\]" } # bash runs this command before each prompt is printed; # we have it redfine the prompt to set the color appropriately. PROMPT_COMMAND='PS1="$(promptcolor $?)\u@\h\[\e[0m\]\$ ";'