Quellcode durchsuchen

Include exit status in window title as well

Alois Mahdal vor 9 Jahren
Ursprung
Commit
de3f72538d
1 geänderte Dateien mit 4 neuen und 5 gelöschten Zeilen
  1. 4
    5
      dotfiles/bash/post.bashrc

+ 4
- 5
dotfiles/bash/post.bashrc Datei anzeigen

@@ -31,15 +31,14 @@ __save_rv() {
31 31
 make_ps1() {
32 32
     # these functions must be already defined by ~/.bash/user/*.bashrc
33 33
     # and ~/.bash/host/*.bashrc
34
-    local svrc='$(__save_rv $?)'
35 34
     local ps1u=$(make_ps1u)
36 35
     local ps1h=$(make_ps1h)
37 36
     local ps1w="$lblue\w$normal";
38 37
     local ps1G='$(__git_ps1 "(%s)")';
39 38
     local ps1g="$green$ps1G$normal";
40
-    local ps1D='$(__make_ps1d)';
39
+    local ps1D='$(__make_ps1d -r)';
41 40
     local ps1d="$lred$ps1D$normal";
42
-    echo "$svrc$ps1u@$ps1h:$ps1w$ps1g$ps1d\$ ";
41
+    echo "$ps1u@$ps1h:$ps1w$ps1g$ps1d\$ ";
43 42
 }
44 43
 
45 44
 make_ps2() {
@@ -56,7 +55,7 @@ export PS2=$(make_ps2)
56 55
 
57 56
 case "$TERM" in
58 57
 xterm*|rxvt*|screen*)
59
-    PROMPT_COMMAND='echo -ne "\033]0;${PWD/$HOME/~}\$\007"'
58
+    PROMPT_COMMAND='__save_rv $?; echo -ne "\033]0;$(__make_ps1d)${PWD/$HOME/~}\$\007"'
60 59
 
61 60
     # Show the currently running command in the terminal title:
62 61
     # http://www.davidpashley.com/articles/xterm-titles-with-bash.html
@@ -74,7 +73,7 @@ xterm*|rxvt*|screen*)
74 73
                 then
75 74
                     echo -ne "\033]0;${BASH_COMMAND} (${PWD/$HOME/~})\007"
76 75
                 else
77
-                    echo -ne "\033]0;${PWD/$HOME/~}\$\007"
76
+                    echo -ne "\033]0;$(__make_ps1d)${PWD/$HOME/~}\$\007"
78 77
                 fi
79 78
                 ;;
80 79
         esac