Last active
December 12, 2015 05:09
-
-
Save limed/4719738 to your computer and use it in GitHub Desktop.
Init's gpg agent if the daemon isn't running and exports the environment variables
This file contains hidden or 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
| envfile="${HOME}/.gnupg/gpg-agent.env" | |
| if test -f "$envfile" && kill -0 $(grep GPG_AGENT_INFO "$envfile" | cut -d: -f 2) 2>/dev/null; then | |
| eval "$(cat "$envfile")" | |
| else | |
| eval "$(gpg-agent --daemon --log-file=~/.gnupg/gpg.log --write-env-file "$envfile")" | |
| fi | |
| export GPG_AGENT_INFO # the env file does not contain the export statement |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment