Skip to content

Instantly share code, notes, and snippets.

@trueheart78
Last active August 29, 2015 14:26
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save trueheart78/efcb8d2beea794f8d538 to your computer and use it in GitHub Desktop.
Save trueheart78/efcb8d2beea794f8d538 to your computer and use it in GitHub Desktop.
#!/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
Copy link
Author

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