From 3aedad7490335796eb80bd549b9f526a699f374d Mon Sep 17 00:00:00 2001
From: Moritz Beber <m.beber@jacobs-university.de>
Date: Wed, 11 Aug 2010 14:21:11 +0200
Subject: fixed bug with SSH_AGENT_PID

The variable SSH_AGENT_PID might still be set, so it should not be used for
testing. Resorted to a ps test instead.
---
 _posts/2009-09-03-working-with-key-passphrases.textile | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

(limited to '_posts/2009-09-03-working-with-key-passphrases.textile')

diff --git a/_posts/2009-09-03-working-with-key-passphrases.textile b/_posts/2009-09-03-working-with-key-passphrases.textile
index 978b9f2..11fd037 100644
--- a/_posts/2009-09-03-working-with-key-passphrases.textile
+++ b/_posts/2009-09-03-working-with-key-passphrases.textile
@@ -47,8 +47,9 @@ function start_agent {
     ssh-add
 }   
 
-# check for running ssh-agent 
-if [ ${SSH_AGENT_PID} ]; then
+# check for running ssh-agent
+ps -ef | grep ${SSH_AGENT_PID} | grep -v grep > /dev/null
+if [ $? -eq 0 ]; then
     # test whether standard identities have been added to
     # the agent already
     ssh-add -l | grep "agent has no identities"
-- 
cgit v1.3.1

