use prompt in rxvt too; better ssh-agent logic
authorDon Armstrong <don@donarmstrong.com>
Mon, 23 Jul 2007 17:59:19 +0000 (17:59 +0000)
committerDon Armstrong <don@donarmstrong.com>
Mon, 23 Jul 2007 17:59:19 +0000 (17:59 +0000)
.bashrc

diff --git a/.bashrc b/.bashrc
index eebab56..8622e18 100644 (file)
--- a/.bashrc
+++ b/.bashrc
@@ -29,6 +29,7 @@ if [ "$PS1" ]; then
     alias emc='sane_editor'
 
     # set a fancy prompt
+    #printf '\33]2;%s\007'
     PS1="\[\033[0;36m\]\h \t \w$\[\033[0m\] "
     # \[\033[1;36m\][\w]\n\[\033[0;36m\][\h|\t]$ \[\033[0m\]
 
@@ -37,6 +38,10 @@ if [ "$PS1" ]; then
        screen|xterm*)
             PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD}\007"'
             ;;
+       rxvt*)
+            PROMPT_COMMAND='echo -ne "\033]2;${USER}@${HOSTNAME}: ${PWD}\007"'
+            ;;
+
        *)
             ;;
     esac
@@ -49,11 +54,13 @@ if [ "$PS1" ]; then
 
     # set up ssh-agent
     if which ssh-agent >/dev/null && [ -d ~/.ssh ]; then
+#      for 
        if [ -e ~/.ssh/ssh_agent_info ] && \
-           kill -0 "$(awk -F '[=;]' '/^SSH_AGENT_PID/{print $2}' ~/.ssh/ssh_agent_info)"; then
+           [ -n "$(awk -F '[=;]' '/^SSH_AGENT_PID/{print $2}' ~/.ssh/ssh_agent_info)" ] && \
+           kill -0 "$(awk -F '[=;]' '/^SSH_AGENT_PID/{print $2}' ~/.ssh/ssh_agent_info)" >/dev/null 2>&1; then
            . ~/.ssh/ssh_agent_info > /dev/null
        elif [ -e ~/.ssh/ssh_agent_info_$(hostname) ] && \
-           kill -0 "$(awk -F '[=;]' '/^SSH_AGENT_PID/{print $2}' ~/.ssh/ssh_agent_info_$(hostname))"; then
+           kill -0 "$(awk -F '[=;]' '/^SSH_AGENT_PID/{print $2}' ~/.ssh/ssh_agent_info_$(hostname))" >/dev/null 2>&1; then
            . ~/.ssh/ssh_agent_info_$(hostname) > /dev/null
        else
            ssh-agent -s > ~/.ssh/ssh_agent_info_$(hostname)