From eab650d501e14f368bb37aae5824cf6fd8ee2d89 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Sat, 9 Jun 2012 13:58:20 +0900 Subject: [PATCH] fix last command status in prompt --- bashrc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/bashrc b/bashrc index 6644c78..d8f8a9b 100755 --- a/bashrc +++ b/bashrc @@ -452,18 +452,24 @@ ip-address(){ } __my_ps1_git(){ + local last=$? __try_exec __git_ps1 "[GIT:$(__try_exec git config --get user.name):%s]" + return $last } __my_ps1_ipaddr(){ + local last=$? test -z "$DISPLAY" && ! iswindows && ip-address [Addr:%s] + return $last } __my_ps1_bttry(){ + local last=$? local bst="/tmp/${USER}-tmp/batterystatus" if test -z "$DISPLAY" && ! iswindows then test -f $bst && echo "[Battery:$(cat $bst)]" __my_battery_status %s >$bst & fi + return $last } __my_ps1_dirs(){ dirs | wc -l @@ -482,7 +488,7 @@ fi _PS1="\ ${__my_c4}:: ${__my_cdef}[${__my_c1}\w/${__my_cdef}<${__my_c3}\${PWD}${__my_cdef}]\$(__my_ps1_bttry)\$(__my_ps1_ipaddr)\n\ ${__my_c4}:: ${__my_c2}\u@\H${__my_cdef} \D{%a, %d %b %Y %T %z} ${SHELL} \V\n\ -${__my_c4}:: ${__my_cdef}shlv:${SHLVL} hist:\! jobs:\j last:\$? \$ " +${__my_c4}:: ${__my_cdef}shlv:${SHLVL} cnum:\# jobs:\j last:\$? \$ " PS1=$_PS1 __my_set_title(){