From 1d4fc8d8aa472d5b1115fd0b3a88ae5e09bf9d82 Mon Sep 17 00:00:00 2001 From: James Blair Date: Wed, 14 Aug 2024 16:04:55 +1200 Subject: [PATCH] Wrap ssh auth sock set in conditional to prevent early exits. --- .bashrc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.bashrc b/.bashrc index 3224445..dc25452 100644 --- a/.bashrc +++ b/.bashrc @@ -126,7 +126,9 @@ if [ -z "$(pgrep ssh-agent)" ]; then else # Set pid + auth sock to ensure existing ssh-agent will be re-used export SSH_AGENT_PID=$(pgrep ssh-agent) - export SSH_AUTH_SOCK=$(find /tmp/ssh-* -name agent.*) + if [ -d "/tmp/ssh" ]; then + export SSH_AUTH_SOCK=$(find /tmp/ssh-* -name agent.*) + fi fi # If ssh-agent has no identities, add mine