Created
November 30, 2023 10:58
-
-
Save laruiss/4f73bdca50e16bcba39fc7d8fc6b43e3 to your computer and use it in GitHub Desktop.
ZSH ssh-agent
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Check for a currently running instance of the agent | |
RUNNING_AGENT="`ps -ax | grep 'ssh-agent -s' | grep -v grep | wc -l | tr -d '[:space:]'`" | |
echo "RUNNING_AGENT: $RUNNING_AGENT" | |
if [ "$RUNNING_AGENT" = "0" ]; then | |
# Launch a new instance of the agent | |
ssh-agent -s &> ~/.ssh/ssh-agent | |
fi | |
eval `cat ~/.ssh/ssh-agent` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment