shell script encrypt a file using gpg

Hi,

I have a requirement to encrypt a file using gpg with a public key. However when i encrypt a file, i get a question like 'Do you want to go ahead with unverified user?' . when i press 'y' file is encrypted.
I am not able to automate this job because of this interactive mode. Could someone please let me know the way i can encrypt the file using shell script by suppressing the interactive nature. so that by default it should just encrypt the file irrespective of any interactive questions.

Thanks
Deepak

You can use expect(1) to answer the question for you if and when it appears but it is undoubtedly better to find out why your encryption software thinks the user is unverified.

Thanks for the reply.
Actually i checked the question.
It says
/*************************************************/
" There is no assurance this key belongs to the named user"

It is NOT certain that the key belongs to the person named
in the user ID. If you *really* know what you are doing,
you may answer the next question with yes.
Use this key anyway? (y/N)
/**************************************************/
If i give y, the file is successfully encrypted. Please note that i am using the below command to encrypt:
gpg --yes -eq -r "key_nm" -o file.pgp file.txt

By the way, i was not able to see the expect command in unix. Does it require any installation? If so where can i find the same.

Sincerely appreciate your help.

Thanks
Deepak

Did you sign the key after importing it ? Unless you sign it, it will not be certified.

tyler_durden