Reputation: 8076
Why isn't this code working in my .bash_profile
?
echo $SSH_AUTH_SOCK
if [ -z "$SSH_AUTH_SOCK" ]; then
ssh-add
fi
My identity is not getting added when shell is opened. The variable $SSH_AUTH_SOCK
is being echoed when the shell opens:
/private/tmp/com.apple.launchd.UKHCb6uhHB/Listeners
So if the variable is defined, why isn't the ssh-add
statement being evaluated?
If I run ssh-add
manually from the command line, or place it on it's own separate line of my .bash_profile
, it successfully runs and adds my identity to the ssh agent.
Additionally, making thing simpler and just trying to echo a value doesn't work, for example, I do not see test
being echoed after placing this in the file:
echo $SSH_AUTH_SOCK
if [ -z "$SSH_AUTH_SOCK" ]; then
echo test
fi
Upvotes: 0
Views: 108