Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm trying to encrypt something with gpg -a and return the result to standard out rather than a file. According to the manual, it should be sufficient to omit an --output flag, but that doesn't seem to be the case. When I don't specify an output file, gnupg assumes I'm outputting to [input-file].gpg rather than stdout.

Is there a way to have GPG do this, or am I going to have to have it encrypt to a temporary file and then cat it?

share|improve this question

2 Answers 2

up vote 3 down vote accepted

Instead of passing the input file to gpg, use shell redirection to send the input file to gpg's stdin, e.g.:

gpg -ac < inputfile
share|improve this answer

Just in case anyone still needs to do this, you can do it with

gpg -ac -o- infile

Setting the output filename to "-" sends the output to stdout.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.