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