0

When I put:

set -xuo pipeline
exec 2> >(tee -a mylog.log) >&2

in the bash script then executed lines and echo messages are being pushed to the console and to the mylog.log.
When I don't put set -xuo pipeline then only echo messages are being pushed to the console and to the mylog.log.

How to to separate those log policy: to the console I want only echo messages and to the file I want executed lines and echo messages.

0

You can add

exec 5> mylog.log
BASH_XTRACEFD="5"
set -x

Then to the mylog.log goes trace logging and to the console echo logging.

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.