Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#!/bin/bash
for f in `find ~/.ssh -perm 600 -type f`
do
add_key=true
for k in `ssh-add -l`
do
if [[ "$k" = "$f" ]]
then
add_key=false
fi
done
if [ $add_key = true ]
then
`ssh-add $f`
fi
done
@trueheart78

This comment has been minimized.

Copy link
Owner Author

@trueheart78 trueheart78 commented Jul 30, 2015

Could be cleaned up a bit to be more efficient, but it works! You can add this to your .bash_profile or .zshrc to autoload all your SSH keys.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment