From c28d5941c18751112421ac6acb50b1bd81d784f3 Mon Sep 17 00:00:00 2001 From: Peter Palfrader Date: Fri, 8 May 2009 19:18:59 +0000 Subject: two more functions git-svn-id: svn+ssh://asteria.noreply.org/svn/weaselutils/trunk@393 bc3d92e2-beff-0310-a7cd-cc87d7ac0ede --- zshfunc/safe-restore-ssh-agent-socket | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 zshfunc/safe-restore-ssh-agent-socket (limited to 'zshfunc/safe-restore-ssh-agent-socket') diff --git a/zshfunc/safe-restore-ssh-agent-socket b/zshfunc/safe-restore-ssh-agent-socket new file mode 100644 index 0000000..f4b9751 --- /dev/null +++ b/zshfunc/safe-restore-ssh-agent-socket @@ -0,0 +1,11 @@ +## vim:ft=zsh:foldmethod=marker + +if [ "$SSH_AUTH_SOCK" != "" ] && [ "$SSH_AUTH_SOCK" != "$HOME/.ssh-auth-sock" ] ; then + if ! [ -e "$HOME/.ssh-auth-sock" ] || [ "`readlink $HOME/.ssh-auth-sock`" != "$SSH_AUTH_SOCK" ]; then + echo "Setting ~/.ssh-auth-sock." + rm -f "$HOME/.ssh-auth-sock" + ln -s "$SSH_AUTH_SOCK" "$HOME/.ssh-auth-sock" + fi +elif [ "$SSH_AUTH_SOCK" = "" ] && [ -e "$HOME/.ssh-auth-sock" ]; then + SSH_AUTH_SOCK="$HOME/.ssh-auth-sock"; export SSH_AUTH_SOCK +fi -- cgit v1.2.3