[Assorted-commits] SF.net SVN: assorted:[1849] shell-tools/trunk/src/bash-commons/bashrc.bash
Brought to you by:
yangzhang
|
From: <yan...@us...> - 2013-03-31 22:33:42
|
Revision: 1849
http://sourceforge.net/p/assorted/svn/1849
Author: yangzhang
Date: 2013-03-31 22:33:40 +0000 (Sun, 31 Mar 2013)
Log Message:
-----------
Add refresh-agent as PROMPT_COMMAND
Modified Paths:
--------------
shell-tools/trunk/src/bash-commons/bashrc.bash
Modified: shell-tools/trunk/src/bash-commons/bashrc.bash
===================================================================
--- shell-tools/trunk/src/bash-commons/bashrc.bash 2013-03-29 01:25:29 UTC (rev 1848)
+++ shell-tools/trunk/src/bash-commons/bashrc.bash 2013-03-31 22:33:40 UTC (rev 1849)
@@ -893,6 +893,16 @@
then eval `keychain --eval --nogui $keychain_flags $keyfile 2> /dev/null`
fi
+# If current socket is no longer there (forwarded ssh agent connection no
+# longer exists) but the keychain script has a good socket, then use that one.
+refresh-agent() {
+ if [[ ! -S $SSH_AUTH_SOCK ]] && ( . ~/.keychain/$HOSTNAME-sh && [[ -S $SSH_AUTH_SOCK ]] )
+ then . ~/.keychain/$HOSTNAME-sh
+ fi
+}
+
+PROMPT_COMMAND=refresh-agent
+
# TODO note that bash_completion usually does a ton of stuff (and in
# particular it re/undefines `have`), so it's best to move this near the
# top
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|