Skip to content

Instantly share code, notes, and snippets.

@robinwo
Created July 21, 2015 09:28
Show Gist options
  • Select an option

  • Save robinwo/06144c8c565409c4ed71 to your computer and use it in GitHub Desktop.

Select an option

Save robinwo/06144c8c565409c4ed71 to your computer and use it in GitHub Desktop.
Load ssh keys on startup
#!/bin/zsh
## load ssh keys
cd ~/.ssh ;
echo ":::: Load SSH keys in agent ::::" ;
for i in * ;
do if [[ -f $i ]] && [[ $i == id_* ]] && [[ $i != *.pub ]];
then
ssh-add -l |grep -q `ssh-keygen -lf $i | awk '{print $2}'` || ssh-add $i;
fi
done ;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment