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.
This commit is contained in:
parent
3e88b8bcdc
commit
ea25ccf62c
1 changed files with 1 additions and 1 deletions
|
@ -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…
Reference in a new issue