Created
June 13, 2010 03:07
-
-
Save scgilardi/436294 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# improved version of the code in Eivind Uggedal's comment at | |
# http://justinchouinard.com/blog/2010/04/10/fix-stale-ssh-environment-variables-in-gnu-screen-and-tmux/ | |
function preexec() { | |
if [[ -n $TMUX ]]; then | |
TMUX_SOCK=$(echo $TMUX|cut -d , -f 1) | |
NEW_SSH_AUTH_SOCK=$(tmux -S $TMUX_SOCK showenv|grep ^SSH_AUTH_SOCK|cut -d = -f 2) | |
if [[ -n $NEW_SSH_AUTH_SOCK ]] && [[ -S $NEW_SSH_AUTH_SOCK ]]; then | |
SSH_AUTH_SOCK=$NEW_SSH_AUTH_SOCK | |
fi | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Awesome! My psshes are so happy.
I like doing it elisp hook-style: