Skip to content

Instantly share code, notes, and snippets.

@hirocaster
Created December 9, 2010 03:42
Show Gist options
  • Save hirocaster/734306 to your computer and use it in GitHub Desktop.
Save hirocaster/734306 to your computer and use it in GitHub Desktop.
$SSH_AUTH_SOCK to Automatic Symbolic Link
agent="$HOME/.ssh-agent-$USER"
if [ -S "$SSH_AUTH_SOCK" ]; then
case $SSH_AUTH_SOCK in
/tmp/*/agent.[0-9]*)
ln -snf "$SSH_AUTH_SOCK" $agent && export SSH_AUTH_SOCK=$agent
esac
elif [ -S $agent ]; then
export SSH_AUTH_SOCK=$agent
else
echo "no ssh-agent"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment