Script .ksh to decrypt .gpg(passphrase)

Hi all,

i have to make a script in shell unix that decrypt a file .gpg ang through out in the same directory the decypted file.

Well, the problem is to put in the shell the passphrase.
Here the specifications:
File .gpg: bella.zip.gpg
File output: bella_decr.zip
passphrase: bella_zio

if someone could write me the right code to decrypt that file is terrific.

Thank you.

if i write simply in the shell:

gpg --passphrase bellazio -d bella.txt.zip.gpg

the shell returns me this error:

gpg: WARNING: using insecure memory!
gpg: please see [site] for more information
Reading passphrase from file descriptor 0 ...

please help!

One way:

echo "bellazio" | gpg --passphrase-fd 0 --output out.txt -d bella.txt.zip.gpg
1 Like

IT WORKS!!!!!

thanks a lot you saved my life

very last question: if i wanto to put the pass into a txt file i write "type pass.txt" istead of "echo ..." but which is the right --passphrase-fd "number"?

One way:

cat passphrase.txt | gpg --passphrase-fd 0 --output out.txt -d bella.txt.zip.gpg