1

Example :

bash$ gpg --batch --edit-key alice quit >/dev/null 2>&1
Secret key is available.

pub  2048R/9F07612A  created: 2017-06-20  expires: never       usage: SCEA
                     trust: ultimate      validity: ultimate
sub  2048R/23B3A24B  created: 2017-06-20  expires: never       usage: SEA 
[ultimate] (1). alice (alice's key) <alice@foo.bar>

I know that using --batch will do the job.

But my question is more "how does GnuPG achieves this 'output anyway' feature"?

  • FYI - Redirect as expected under OSX 10.11 (El Capitan) and NetBSD 7.0.2. – Deathgrip Jun 20 '17 at 22:50
3

Probably by writing to /dev/tty or equivalent, that's what ssh does.

$ hi() { echo hello > /dev/tty; }
$ hi &>/dev/null 
hello

On Linux, at least, opening /dev/tty opens the controlling terminal of the process.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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