#!/bin/bash if [ "`pgrep ssh-agent`" == "" ]; then echo "ssh-agent not running. this is .bashrc's task" exit 1 fi if [ "$SSH_AUTH_SOCK" == "" ]; then echo "variables were not initialized... attempting to recover" if [ -f "/tmp/sshagent" ]; then . /tmp/sshagent if [ "$SSH_AUTH_SOCK" != "" ]; then echo "nope.avi - fix .bashrc so that it outputs a valid /tmp/sshagent" exit 1 fi else echo "no /tmp/sshagent, this is .bashrc's fault" exit 1 fi fi ssh-add