I have the file secret.txt.gpg which I would like to decrypt, such that the content is stored within a variable like that:
TXT=$(gpg --decrypt secret.txt.gpg)
But this way a lot of extra gpg: … lines are added, containing information about the key etc. like that:
gpg: encrypted with 4096-bit RSA key, ID xxxx, created xxxx
"xx xx (xx) <xx@xx.xx>"
gpg: Signature made xxx
gpg: using RSA key xxx
…
Secret Message
By the way:
gpg -d secret.txt.gpg > out.txt
is just writing the content into the file.
How can I capture the content only, without writing it to a file?
update
Even though @Roger Answer is better and explains the why, I could make it using this:
TXT=$(gpg --decrypt secret.txt.gpg > /dev/stdout)