Inside bashscript, I am using exec and tee to redirect logs to stdout and a log file in the same time - Unix & Linux Stack Exchange.

exec &> >(tee -a "${LogFile}")

I am sourcing another script (to set some environment variable) inside this script as follows:

source "${AnotherScript}" 2>&1 | tee -a "${LogFile}"

But, this logs the output only for the parent script, and not for the scripts that are called inside the parent scripts.

How should I modify this command, to log the complete output of all the scripts?

  • Can't reproduce said behaviour. And, the redirection for the sourced script seems redundant - all the redirections desired are already done. – RudiC Oct 6 '18 at 11:04

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.