penguin/utils

my env utils

commit 2e3416053417e330bb06f450f25b0c2685b67cde

author斟酌 鵬兄 <tgckpg@gmail.com>
date2014-10-10T02:21:44Z
subjectFix exit code for 10_ssh-agent
commit 2e3416053417e330bb06f450f25b0c2685b67cde
Author: 斟酌 鵬兄 <tgckpg@gmail.com>
Date:   2014-10-10T02:21:44Z

    Fix exit code for 10_ssh-agent
---
 bash/bashrc/sources/09_ssh-agent | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/bash/bashrc/sources/09_ssh-agent b/bash/bashrc/sources/09_ssh-agent
index 3b21ced..40ec3c9 100755
--- a/bash/bashrc/sources/09_ssh-agent
+++ b/bash/bashrc/sources/09_ssh-agent
@@ -8,7 +8,15 @@ function start_agent {
     echo succeeded
     chmod 600 "${SSH_ENV}"
     . "${SSH_ENV}" > /dev/null
+
+    # Test the ssh-add if status return 0/1, agent is initialized
     /usr/bin/ssh-add;
+    ST=$?
+    if [ $ST -ne 0 ] && [ $ST -ne 1 ]; then
+        return $ST
+    fi
+
+    return 0
 }
 
 # Source SSH settings, if applicable