`tty` command infers the current TTY from file descriptor 0.
`$TTY` gives current TTY directly. The latter works even when
file descriptor 0 is redirected. It's also over 1000 times faster.
From GnuPG changelog:
> Removed the GPG_AGENT_INFO related code. GnuPG does now
> always use a fixed socket name in its home directory.
Signed-off-by: Sorin Ionescu <sorin.ionescu@gmail.com>
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.