I've read man on
exec, but still don't understand the consequences of the two following lines in the script I'm studying:
exec >> >(tee -a $logfile) exec 2>&1
I've read this answer, but still have doubts.
My understanding is that first line makes
>> output (append) also to
$logfile in addition whatever is to the right of
>> further in the script file.
The second line will make output to 2 (stderr) be redirected to 1 (stdout) further in the script.
- Is my understanding correct?
- How to undo the above commands so behavior after undoing is the same as it was before those two lines were executed?
- Lets say further in the script we start some app in background e.g.
someapp &. I want to run this command in terminal - separately and independently from the script - with the same effect as if it runs in the script. How should I modify
someapp &to have redirections set with