Skip to content

Instantly share code, notes, and snippets.

@alexwright
Created February 2, 2014 16:41
Show Gist options
  • Save alexwright/8771149 to your computer and use it in GitHub Desktop.
Save alexwright/8771149 to your computer and use it in GitHub Desktop.
Find the most recently created ssh-agent socket and export it to the current session.
#!/bin/bash
export SSH_AUTH_SOCK=$(find /tmp/ssh-* -user `whoami` -name agent\* -printf '%T@ %p\n' | sort -k 1nr | sed 's/^[^ ]* //' | head -n 1);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment