Fixed a bug in which get-ssh-agent would not actually source the env file when run the first time.

main
Emily Frost 3 years ago
parent b2f2f7d86e
commit 7b8580be9c
Signed by: Emily
GPG Key ID: AA5D42849F1CBDC9

@ -13,9 +13,11 @@ else
fi
function _start_new_ssh_agent () {
ssh_agent_file=$1
killall ssh-agent
# start a new ssh-agent and write its output to the env file.
ssh-agent | grep -v echo >&"$ssh_agent_env_file"
ssh-agent | grep -v echo >& "$ssh_agent_file"
source "$ssh_agent_file"
echo "New ssh-agent started."
ssh-add
}
@ -27,9 +29,9 @@ if [[ -e "$ssh_agent_env_file" ]]; then
echo "Existing ssh-agent environment configured with pid ${SSH_AGENT_PID}."
else
echo "Existing ssh-agent appears to be dead."
_start_new_ssh_agent
_start_new_ssh_agent "$ssh_agent_env_file"
fi
else
echo "No existing ssh-agent found."
_start_new_ssh_agent
_start_new_ssh_agent "$ssh_agent_env_file"
fi

Loading…
Cancel
Save