summaryrefslogtreecommitdiffstats
path: root/.zsh/ssh-agent-setup.sh
blob: 989192f5ed095babfafa75122c87225c9a8ef69c (plain)
1
2
3
4
5
6
7
8
# Starts the ssh-agent if it is not running, and either way it sources the required environment variables.

if [ -z "$(ps -e | grep ssh-agent)" ]; then
    # ssh-agent does not seem to be running, start it
    ssh-agent | sed -r '/echo Agent pid [0-9]+;/d' > "$HOME/.ssh/session"
fi

eval $(<"$HOME/.ssh/session")