0

I have a command line:

# Download and add the Nginx GPG key to verify the authenticity of the packages.
wget -O - https://nginx.org/keys/nginx_signing.key | sudo gpg --dearmor | sudo  tee /usr/share/keyrings/nginx-archive-keyring.gpg

That writes the correct data to the keyring, but sprays it to the terminal also. I tried changing sudo tee to sudo cat >, but '>' isn't part of the sudo, so I get a broken pipe.

I also tried various ways of redirecting stdout to /dev/null but still get broken pipe.

Is there a clean way to avoid tee sending the key binary code to the terminal ?

gwhiz
  • 3

1 Answers1

0

By definition (man tee) the tee command duplicates what it reads on stdin to its named file(s) as well as copying it through to stdout.

If you don't want the output just redirect it to /dev/null:

... | sudo tee outfile >/dev/null
Chris Davies
  • 116,213
  • 16
  • 160
  • 287