1
0
Fork 0

Set default GPG_AGENT_PID for grep

If `GPG_AGENT_PID` is unset, grep will succeed if another gpg-agent is
running as it will match the string `gpg-agent` where the PID was an
empty string. Set a default value for grep to a value that will never
match if unset, i.e. -1.
pull/688/head
Sorin Ionescu 10 years ago
parent 3e88b8bcdc
commit ea25ccf62c

@ -15,7 +15,7 @@ _gpg_agent_conf="$HOME/.gnupg/gpg-agent.conf"
_gpg_agent_env="${TMPDIR:-/tmp}/gpg-agent.env"
# Start gpg-agent if not started.
if ! ps -U "$USER" -o ucomm | grep -q gpg-agent; then
if ! ps -U "$USER" -o pid,ucomm | grep -q -- "${GPG_AGENT_PID:--1} gpg-agent"; then
eval "$(gpg-agent --daemon | tee "$_gpg_agent_env")"
else
# Export environment variables.

Loading…
Cancel
Save