initial
[zsh.git] / .zsh / functions / safe-restore-ssh-agent-socket
1 ## vim:ft=zsh:foldmethod=marker
2
3 if [ "$SSH_AUTH_SOCK" != "" ] && [ "$SSH_AUTH_SOCK" != "$HOME/.ssh-auth-sock" ] ; then
4 if ! [ -e "$HOME/.ssh-auth-sock" ] || [ "`readlink $HOME/.ssh-auth-sock`" != "$SSH_AUTH_SOCK" ]; then
5 echo "Setting ~/.ssh-auth-sock."
6 rm -f "$HOME/.ssh-auth-sock"
7 ln -s "$SSH_AUTH_SOCK" "$HOME/.ssh-auth-sock"
8 fi
9 elif [ "$SSH_AUTH_SOCK" = "" ] && [ -e "$HOME/.ssh-auth-sock" ]; then
10 SSH_AUTH_SOCK="$HOME/.ssh-auth-sock"; export SSH_AUTH_SOCK
11 fi