Browse Source

Do iclude host identification on remote session

Alois Mahdal 10 years ago
parent
commit
2d8bcec24e
1 changed files with 5 additions and 3 deletions
  1. 5
    3
      dotfiles/bash/post.bashrc

+ 5
- 3
dotfiles/bash/post.bashrc View File

55
 
55
 
56
 case "$TERM" in
56
 case "$TERM" in
57
 xterm*|rxvt*|screen*)
57
 xterm*|rxvt*|screen*)
58
-    PROMPT_COMMAND='__save_rv $?; echo -ne "\033]0;$(__make_ps1d)${PWD/$HOME/\~}\$\007"'
58
+    test -n "$SSH_CONNECTION" \
59
+     && __host_id="${HOSTNAME%%.*}:"      # i.e. a remote session
60
+    PROMPT_COMMAND='__save_rv $?; echo -ne "\033]0;$(__make_ps1d)$__host_id${PWD/$HOME/\~}\$\007"'
59
 
61
 
60
     # Show the currently running command in the terminal title:
62
     # Show the currently running command in the terminal title:
61
     # http://www.davidpashley.com/articles/xterm-titles-with-bash.html
63
     # http://www.davidpashley.com/articles/xterm-titles-with-bash.html
71
             *)
73
             *)
72
                 if test -n "${BASH_COMMAND}";
74
                 if test -n "${BASH_COMMAND}";
73
                 then
75
                 then
74
-                    echo -ne "\033]0;${BASH_COMMAND} (${PWD/$HOME/\~})\007"
76
+                    echo -ne "\033]0;${BASH_COMMAND} ($__host_id${PWD/$HOME/\~})\007"
75
                 else
77
                 else
76
-                    echo -ne "\033]0;$(__make_ps1d)${PWD/$HOME/\~}\$\007"
78
+                    echo -ne "\033]0;$(__make_ps1d)$__host_id${PWD/$HOME/\~}\$\007"
77
                 fi
79
                 fi
78
                 ;;
80
                 ;;
79
         esac
81
         esac