From da886631862f337990b61e6fb60e375a23e7cf06 Mon Sep 17 00:00:00 2001 From: meh Date: Tue, 28 Feb 2012 15:00:30 +0100 Subject: [PATCH] Fix SSH Agent identities. --- plugins/ssh-agent/init.zsh | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/plugins/ssh-agent/init.zsh b/plugins/ssh-agent/init.zsh index 486d519..4996f22 100644 --- a/plugins/ssh-agent/init.zsh +++ b/plugins/ssh-agent/init.zsh @@ -27,14 +27,21 @@ function _ssh-agent-start() { local -a identities # Start ssh-agent and setup the environment. - /usr/bin/env ssh-agent | sed 's/^print/#print/' > "${_ssh_agent_env}" + rm -f "${_ssh_agent_env}" + ssh-agent > "${_ssh_agent_env}" chmod 600 "${_ssh_agent_env}" source "${_ssh_agent_env}" > /dev/null # Load identies. zstyle -a ':omz:plugin:ssh-agent' identities 'identities' - print starting... - /usr/bin/ssh-add "$HOME/.ssh/${^identities}" + + print starting ssh-agent... + + if [[ ! -n "${identities}" ]]; then + ssh-add + else + ssh-add "$HOME/.ssh/${^identities}" + fi } # Test if agent-forwarding is enabled.