aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMitch Riedstra <mitch@riedstra.us>2019-04-08 01:34:14 -0400
committerMitch Riedstra <mitch@riedstra.us>2019-04-08 01:34:14 -0400
commitc262cfc0b32711932e4e31597a26fcffe9fe5740 (patch)
tree4b041cd1fb7f8706a1637b43f408e4ebb9498276
parenteeea5cc2ba916dfbf439592c2e193d6e3d6ad5b3 (diff)
downloaddotfiles-c262cfc0b32711932e4e31597a26fcffe9fe5740.tar.gz
dotfiles-c262cfc0b32711932e4e31597a26fcffe9fe5740.tar.xz
Make the checkSSHAgent function a little bit more robust
-rw-r--r--mkshrc5
1 files changed, 4 insertions, 1 deletions
diff --git a/mkshrc b/mkshrc
index 3d78f8c..606154b 100644
--- a/mkshrc
+++ b/mkshrc
@@ -368,7 +368,10 @@ checkSSHAgent() {
if [ -e "$ssh_agent_conf" ] ; then
. "$ssh_agent_conf"
fi
- if ! ps -eo pid | grep -q "$SSH_AGENT_PID" ; then
+ if ! ps -eo pid | grep -q "$SSH_AGENT_PID" \
+ || ! [ -e "$ssh_agent_conf" ] \
+ || [ -z "$SSH_AGENT_PID" ] ; \
+ then
ssh-agent -s | grep -v echo > "$ssh_agent_conf"
. "$ssh_agent_conf"
fi