The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Advanced & Expert Users
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 07-03-2009
apsprabhu apsprabhu is offline
Registered User
  
 

Join Date: Feb 2008
Posts: 43
Decrypt a GPG file through shell script

Hi,

I'm trying to decrypt a gpg file thorugh a shell script. But i' could'nt. My script is ,

-sh-3.1$ cat test_gpg.sh
#!/bin/ksh

echo " Hello, iam testing GPG"

gpg prabhu.txt.gpg <<EOF
prompt prabhu
EOF
exit 0


The file i'm trying to decrypt is prabhu.txt.gpg and my passphrase is "prabhu".

Can someone please help me on this ASAP.

---------- Post updated 07-03-09 at 06:37 PM ---------- Previous update was 07-02-09 at 08:51 PM ----------

Hi all,

Just sharing this for informative purpose.

My below script works succesfully.

#!/bin/ksh

### Fetching the password from file or database
pass_phrase=`cat radhas_pwd|awk '{print $1}'`

### Decrypting the encrypted file by passing the passphrase and the output file
gpg --passphrase $pass_phrase --output prabhu.txt --decrypt prabhu.txt.gpg

exit