decrypt stdin with passphrase in command line

Nomen Nescio
Wed Jun 25 11:02:09 2003

John Sheridan [21/06/2003]:
> Hi Joseph, can you show me the syntax of doing this? I tried this before:
> cat file.gpg | gpg --homedir $gnupg_home --passphrase-fd 0 --no-tty --decrypt 2>&- <<EOF
> mypassphrase
> But it probably means cat file.gpg and mypassphrase are sharing
> stdin, that's why it doesn't work. I don't know how to make this go
> in via another file descriptor.

(assuming a bourne shell here)

echo "mypassphrase" > passfile
gpg --homedir $gnupg_home --passphrase-fd=3 --no-tty --decrypt \
	3<passfile <file.gpg && rm -f passfile