title: How to check if ssh-agent is already running in bash?
body: <p>I have a sample <code>sh</code> script on my Linux environment, which basically run's the <code>ssh-agent</code> for the current shell, adds a key to it and runs two git commands:</p>
  
  <pre><code>#!/bin/bash
  eval "$(ssh-agent -s)"
  ssh-add /home/duvdevan/.ssh/id_rsa
  
  git -C /var/www/duvdevan/ reset --hard origin/master
  git -C /var/www/duvdevan/ pull origin master
  </code></pre>
  
  <p>Script actually works fine, but every time I run it I get a new process so I think it might become a performance issue and I might end up having useless processes out there.</p>
  
  <p>An example of the output:</p>
  
  <pre><code>Agent pid 12109
  Identity added: /home/duvdevan/.ssh/custom_rsa (rsa w/o comment)
  </code></pre>
  
  <p>Also, along with all this, is it possible to find an existing <code>ssh-agent</code> process and add my keys into it?</p>