For 2, see chronic[0] (part of moreutils[1]). It runs a command, muting stdout and stderr unless the command exits with a non-zero status.
[0]: https://manpages.debian.org/jessie/moreutils/chronic.1.en.ht...
[0]: https://manpages.debian.org/jessie/moreutils/chronic.1.en.ht...
No comments yet.