Skip to content

Instantly share code, notes, and snippets.

@Lunik
Last active October 25, 2019 07:12
Show Gist options
  • Save Lunik/d41b9409cd7eada5b462f6704b23b6f9 to your computer and use it in GitHub Desktop.
Save Lunik/d41b9409cd7eada5b462f6704b23b6f9 to your computer and use it in GitHub Desktop.
Agent loading in bashrc
# GPG
function start_gpg_agent() {
echo "[GPG] Starting agent"
gpg-agent --daemon 2>&1 >/dev/null
}
gpg_daemon_pid=$(pgrep gpg-agent)
ping_process=$(kill -0 "${gpg_daemon_pid}" 2>&1 >/dev/null)
if [ "$?" -ne "0" ]; then
start_gpg_agent
fi
GPG_TTY=$(tty)
export GPG_TTY
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment