Browse Source

fix last command status in prompt

pull/1/head
10sr 12 years ago
parent
commit
eab650d501
1 changed files with 7 additions and 1 deletions
  1. +7
    -1
      bashrc

+ 7
- 1
bashrc View File

@@ -452,18 +452,24 @@ ip-address(){
} }


__my_ps1_git(){ __my_ps1_git(){
local last=$?
__try_exec __git_ps1 "[GIT:$(__try_exec git config --get user.name):%s]" __try_exec __git_ps1 "[GIT:$(__try_exec git config --get user.name):%s]"
return $last
} }
__my_ps1_ipaddr(){ __my_ps1_ipaddr(){
local last=$?
test -z "$DISPLAY" && ! iswindows && ip-address [Addr:%s] test -z "$DISPLAY" && ! iswindows && ip-address [Addr:%s]
return $last
} }
__my_ps1_bttry(){ __my_ps1_bttry(){
local last=$?
local bst="/tmp/${USER}-tmp/batterystatus" local bst="/tmp/${USER}-tmp/batterystatus"
if test -z "$DISPLAY" && ! iswindows if test -z "$DISPLAY" && ! iswindows
then then
test -f $bst && echo "[Battery:$(cat $bst)]" test -f $bst && echo "[Battery:$(cat $bst)]"
__my_battery_status %s >$bst & __my_battery_status %s >$bst &
fi fi
return $last
} }
__my_ps1_dirs(){ __my_ps1_dirs(){
dirs | wc -l dirs | wc -l
@@ -482,7 +488,7 @@ fi
_PS1="\ _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_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_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 PS1=$_PS1


__my_set_title(){ __my_set_title(){


Loading…
Cancel
Save