# This function ensures gpg commands will work properly, in the current shell. I have found it needful on # OS X when using a smartcard and gpg-agent for ssh auth, in particular. function gpg-up() { while [[ $(ps axu | grep gpg-agent | grep -v grep | wc -l | tr -d ' ') -ne '0' ]]; do pkill gpg-agent sleep 1 done gpg-agent --daemon . ~/.gpg-agent-info GPG_TTY=$(tty) export GPG_TTY GPG_AGENT_INFO SSH_AUTH_SOCK SSH_AGENT_PID }