A shell command to refresh SSH_AUTH_SOCK in a running tmux session
r () { | |
if [[ -n $TMUX ]] | |
then | |
NEW_SSH_AUTH_SOCK=`tmux showenv|grep "^SSH_AUTH_SOCK"|cut -d = -f 2` | |
if [[ -n $NEW_SSH_AUTH_SOCK ]] && [[ -S $NEW_SSH_AUTH_SOCK ]] | |
then | |
echo "New auth sock: $NEW_SSH_AUTH_SOCK" | |
SSH_AUTH_SOCK=$NEW_SSH_AUTH_SOCK | |
fi | |
NEW_DISPLAY=`tmux showenv|grep "^DISPLAY"|cut -d = -f 2` | |
if [[ -n $NEW_DISPLAY ]] | |
then | |
echo "New display: $NEW_DISPLAY" | |
DISPLAY=$NEW_DISPLAY | |
fi | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This comment has been minimized.
I got this from @cmccoy and couldn't find it anywhere else so pasted it here.