#!/usr/bin/env bash ENVFILE="${XDG_RUNTIME_DIR:-$XDG_DATA_HOME}/ssh-agent.env" if [ -f $ENVFILE ] ; then . $ENVFILE > /dev/null if ! kill -0 $SSH_AGENT_PID > /dev/null 2>&1; then eval $(ssh-agent | tee $ENVFILE) ssh-add fi else eval $(ssh-agent | tee $ENVFILE) ssh-add fi