I'm unclear what the best order is to capture both
STDOUT to the same file using
tee. I know that if I want to pipe to a file I have to map the filehandle after the redirect, i.e.
find . >/tmp/output.txt 2>&1
This instructs the shell to send
/tmp/output.txt and then to send
STDOUT (which is now sending to
Attempting to perform the
2>&1 before redirecting the file will not have the desired effect.
However when I want to pipe using
tee should it be:
find . |tee /tmp/output.txt 2>&1 # or find . 2>&1 |tee /tmp/output.txt # ?