From 7f8f753037e1b18eafe4d325c5315a0dc3f90a9a Mon Sep 17 00:00:00 2001 From: Anthony Perkins Date: Thu, 6 Feb 2020 11:20:47 +0000 Subject: [PATCH] Fix SSH detection --- roles/home-cli/files/shrc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/roles/home-cli/files/shrc b/roles/home-cli/files/shrc index e68d75c..2f32faf 100644 --- a/roles/home-cli/files/shrc +++ b/roles/home-cli/files/shrc @@ -250,8 +250,8 @@ case $- in ;; esac -if test -S $SSH_AUTH_SOCK && test -r $HOME/.ssh/id_rsa && [ $(ssh-add -l | grep "$HOME/.ssh/id_rsa" | wc -l) = 0 ]; then - ssh-add $HOME/.ssh/id_rsa +if test -S "$SSH_AUTH_SOCK" && test -r "$HOME/.ssh/id_rsa" && [ $(ssh-add -l | grep "$HOME/.ssh/id_rsa" | wc -l) = 0 ]; then + ssh-add "$HOME/.ssh/id_rsa" fi if [ -r $HOME/.shrc.$(hostname -s) ]; then