decrypting to stdout does not work properly

Fourhundred Thecat 400thecat at ik.me
Mon Oct 7 05:09:31 CEST 2024


Hello,

I have a script to decrypt a file and send it to another program:

  gpg -q -d "$filename" | mpv -

this works fine when my gpg agent is already unlocked, ie the passphrase
is alredy cached.

But when the agent is not yet unlocked, I get some garbled passphrase
prompt which breaks my terminal, and even typing the passphrase does not
work

what do I need to do?

check first whether agent is unlocked, and if not unlock it first and
only then proceed with gpg -d?

how would I check that?

I tried this:

if echo "test" | gpg --sign --quiet >/dev/null 2>/dev/null ; then

which sort of works, but looks convoluted and also has few hundred
milliseconds delay

Also, is there a command for unlocking the agent without actually
decrypting anything ?

thank you,



More information about the Gnupg-users mailing list