How to disable stdout or stderr in bash scripts temporarily?
Of course the most common way is to redirect stdout or stderr to /dev/null.
But on some systems /dev/null may be unwritable for normal users.
I am writing some scripts that is aim to be portable, so I do not prefer using /dev/null
Some blogs/posts say that >&- can close stdout, but when I tried echo 123 >&- in a bash terminal,
I got stuck on this one, and this time I will not continue banging my had against the wall before I open this thread.
here is my deal: tar write to stdout, pipe to a CMD for post processing, redirect the verbose output of tar to tar.log and stderr to tar_err.log while not touching stdout or stderr of the CMD of the post proc.