diff options
Diffstat (limited to 'ssh/ssh.sh')
-rw-r--r-- | ssh/ssh.sh | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/ssh/ssh.sh b/ssh/ssh.sh new file mode 100644 index 0000000..9abfbdb --- /dev/null +++ b/ssh/ssh.sh @@ -0,0 +1,10 @@ +if [ -z "$SSH_AUTH_SOCK" ]; then + # Check for a currently running instance of the agent + RUNNING_AGENT="`ps -ax | grep 'ssh-agent -s' | grep -v grep | wc -l | tr -d '[:space:]'`" + if [ "$RUNNING_AGENT" = "0" ]; then + # Launch a new instance of the agent + ssh-agent -s &> $HOME/.ssh/ssh-agent + fi + eval `cat $HOME/.ssh/ssh-agent` > /dev/null + ssh-add &> /dev/null +fi |