Skip to content

Instantly share code, notes, and snippets.

@trq
Created October 22, 2013 11:25
Show Gist options
  • Save trq/7098980 to your computer and use it in GitHub Desktop.
Save trq/7098980 to your computer and use it in GitHub Desktop.
load_ssh_agent() {
local keys="$@"
local tmp=~/.ssh-agent
if [ -e $tmp ] ; then
. $tmp
fi
ssh-add -l > /dev/null
if [ $? != 0 ] ; then
ssh-agent -s > $tmp
. $tmp
ssh-add $keys
fi
}
load_ssh_agent $HOME/.ssh/somekey $HOME/.ssh/someotherkey
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment