diff --git a/.zshrc b/.zshrc index eaa2e4c..a6ac8b6 100644 --- a/.zshrc +++ b/.zshrc @@ -70,4 +70,16 @@ alias getunicode="perl -C7 -ne 'for(split(//)){print sprintf(\"U\+\%04X\", ord). alias mkenv="python3.7 -m venv .env && source .env/bin/activate" alias senv="source .env/bin/activate" +if [ -z "$SSH_AUTH_SOCK" ] +then + # 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:]'`" + if [ "$RUNNING_AGENT" = "0" ] + then + # Launch a new instance of the agent + ssh-agent -s &> ~/.ssh/ssh-agent + fi + eval `cat ~/.ssh/ssh-agent` +fi + prompt_context() {}