From a87973d1592be7ab88f4f95e35efbb72fba77210 Mon Sep 17 00:00:00 2001 From: Dan Buch Date: Wed, 14 Mar 2012 20:10:37 -0400 Subject: [PATCH] A bit more subtle. More informative, too. Probably slower, though. dunno. --- bash_functions | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/bash_functions b/bash_functions index 4a77c6c..439d83a 100644 --- a/bash_functions +++ b/bash_functions @@ -211,12 +211,22 @@ function rss_pid_command(){ } +function exit_status() { + if [[ $1 -eq 0 ]]; then + echo "\[\033[1;32m\]✓\[\033[00m\]" + else + echo "\[\033[1;31m\]✗\[\033[00m\]:\[\033[31m\]$1\[\033[00m\]" + fi +} + + function precmd(){ - PS1="\[\033[01;32m\]\u@\h\[\033[00m\]⋮\[\033[01;32m\]" + last_status=$? + PS1="\[\033[1;32m\]\u@\h\[\033[00m\]:\[\033[1;32m\]" PS1="$PS1$(trunc_pwd)\[\033[00m\] " local pcla="$(which print-color-loadavg 2>/dev/null)" - test -n "$pcla" && test -x $pcla && PS1="$PS1⎛$(print-color-loadavg)⎠ " - PS1="$PS1$(__git_ps1 "⎛%s⎠")\n≻ " + test -n "$pcla" && test -x $pcla && PS1="$PS1-$(print-color-loadavg)- " + PS1="$PS1$(__git_ps1 "(%s)")\n$(exit_status $last_status) " if [ -n "$1" ] then