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