0

Consider the following code:

exec > >(tee mylog.stdout) 2> >(tee mylog.stderr >&2)
#                                                ^^^
# why do we need this >&2 ? If removed, script does not terminate immediately.

echo A >&2
cat bar
echo B >&2

If I remove >&2 from tee mylog.stderr >&2 then script doesn't behave as expected.

Can you explain why do we need >&2 there?

Your Answer

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

Browse other questions tagged or ask your own question.