#!/bin/bash -vx FILE=~/.ssh/agent if pgrep -u `id -u` ssh-agent >/dev/null; then eval `cat $FILE` else ssh-agent | grep -v Agent > $FILE eval `cat $FILE` ssh-add fi # can't work, the agent socket gets closed when the process is over #. $1