Skip to content

Instantly share code, notes, and snippets.

@odlp
Last active October 7, 2016 13:33
Show Gist options
  • Save odlp/817804b7889f608e4a8511fdbe50fdd3 to your computer and use it in GitHub Desktop.
Save odlp/817804b7889f608e4a8511fdbe50fdd3 to your computer and use it in GitHub Desktop.
Highlight non-zero exit status for bash-it
function prompt_command() {
highlight_non_zero_exit
PS1="\n${yellow}$(ruby_version_prompt) ${purple}\h ${reset_color}in ${green}\w\n${bold_cyan}$(scm_char)${green}$(scm_prompt_info) ${green}→${reset_color} "
}
function highlight_non_zero_exit() {
PASS=$?
if [[ $PASS != 0 ]]; then
printf "${echo_bold_red}> Exit status $PASS <${echo_reset_color}\n"
fi
}
PROMPT_COMMAND=prompt_command;
@odlp
Copy link
Author

odlp commented Oct 7, 2016

screenshot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment