[Assorted-commits] SF.net SVN: assorted:[1851] shell-tools/trunk/src/bash-commons/bashrc.bash
Brought to you by:
yangzhang
From: <yan...@us...> - 2013-03-31 22:38:46
|
Revision: 1851 http://sourceforge.net/p/assorted/svn/1851 Author: yangzhang Date: 2013-03-31 22:38:44 +0000 (Sun, 31 Mar 2013) Log Message: ----------- Add update-agent, add more comments on refresh-agent 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-31 22:35:43 UTC (rev 1850) +++ shell-tools/trunk/src/bash-commons/bashrc.bash 2013-03-31 22:38:44 UTC (rev 1851) @@ -895,12 +895,20 @@ # 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. +# Useful if for instance you started a screen session from one ssh connection +# (which has its own forwarded agent socket), then that connection dies and you +# reconnect (now with a different forwarded agent socket), but all your screen +# session shells still exist with a reference to the old socket - with this, +# and with a run of update-agent, the shells can now use the new socket. refresh-agent() { if [[ ! -S $SSH_AUTH_SOCK ]] && ( . ~/.keychain/$HOSTNAME-sh && [[ -S $SSH_AUTH_SOCK ]] ) then . ~/.keychain/$HOSTNAME-sh fi } +# Save the current environment's agent. +update-agent() { keychain --nogui --inherit any; } + PROMPT_COMMAND=refresh-agent # TODO note that bash_completion usually does a ton of stuff (and in This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |