1
0
mirror of https://github.com/dcarrillo/prezto.git synced 2024-12-22 06:58:01 +00:00

[Fix #479] Start only one ssh-agent instance

This commit is contained in:
Sorin Ionescu 2013-09-26 14:46:21 -04:00
parent aacff80984
commit a4bacb8bb9

View File

@ -21,10 +21,13 @@ _ssh_agent_sock="$TMPDIR/ssh-agent.sock"
# Start ssh-agent if not started.
if [[ ! -S "$SSH_AUTH_SOCK" ]]; then
eval "$(ssh-agent | sed '/^echo /d' | tee "$_ssh_agent_env")"
else
# Export environment variables.
source "$_ssh_agent_env" 2> /dev/null
# Start ssh-agent if not started.
if ! ps -U "$USER" -o pid,ucomm | grep -q "${SSH_AGENT_PID} ssh-agent"; then
eval "$(ssh-agent | sed '/^echo /d' | tee "$_ssh_agent_env")"
fi
fi
# Create a persistent SSH authentication socket.