From 465415bea2d7cb9251d3f5f2e0742cacc66ecf35 Mon Sep 17 00:00:00 2001 From: Alexis Lahouze Date: Tue, 1 Oct 2013 02:09:27 +0200 Subject: [PATCH] Improve identity adding. --- plugins/ssh-agent/ssh-agent.plugin.zsh | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/plugins/ssh-agent/ssh-agent.plugin.zsh b/plugins/ssh-agent/ssh-agent.plugin.zsh index 7f87ebc..fe9ab18 100644 --- a/plugins/ssh-agent/ssh-agent.plugin.zsh +++ b/plugins/ssh-agent/ssh-agent.plugin.zsh @@ -246,13 +246,11 @@ function _ssh_agent_plugin_add_identities() { local _ssh_agent_plugin_identity for _ssh_agent_plugin_identity in ${_ssh_agent_plugin_identities}; do - local _ssh_agent_plugin_identity_absolute_path - _ssh_agent_plugin_identity_absolute_path=$(readlink -f "${_ssh_agent_plugin_directory}/${_ssh_agent_plugin_identity}") + local _ssh_agent_plugin_identity_path + _ssh_agent_plugin_identity_path="${_ssh_agent_plugin_directory}/${_ssh_agent_plugin_identity}" - if [ -r "${_ssh_agent_plugin_identity_absolute_path}" ]; then - ssh-add -l | awk '{print $3}' | while read _ssh_agent_plugin_added_identity; do - readlink -f "${_ssh_agent_plugin_added_identity}" | grep -q "${_ssh_agent_plugin_identity_absolute_path}" - done + if [ -r "${_ssh_agent_plugin_identity_path}" ]; then + ssh-add -l | awk '{print $3}' | grep -q "${_ssh_agent_plugin_identity_absolute_path}" if [ $? -ne 0 ]; then _ssh_agent_plugin_debug "Adding ${_ssh_agent_plugin_identity} identity."