Last active
August 29, 2015 14:20
-
-
Save facundobianco/3f91b9e9597fdd1064d8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ssh() | |
{ | |
if [ -z "$SSH_AUTH_SOCK" ] | |
then | |
eval `/usr/bin/ssh-agent` | |
elif [ "$SSH_AUTH_SOCK" != "`echo /tmp/ssh-*/agent.*`" ] | |
then | |
export SSH_AUTH_SOCK=`echo /tmp/ssh-*/agent.*` | |
fi | |
if [ `ssh-add -l > /dev/null 2>&1 ; echo $?` -eq 1 ] | |
then | |
echo "ssh-agent has no identities" | |
ssh-add -t 12h ${SSH_PRVKEY} && echo "" | |
fi | |
if [ "$?" -eq 0 ] | |
then | |
/usr/bin/ssh ${@} | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment