Assuming you dont have an executable called abcdef, the following writes an error message (like "command not found") to a file called myfile.out:
Code:
abcdef > myfile.out 2>&1
I want to see the output as it is written to the file, so I tried this:
Code:
abcdef | tee myfile.out 2>&1
What I want is for the stderr message to be redirected into myfile.out as well as stdout, but to be viewed as it generated (via the tee command), but the 2>&1 doesn't work in the above code.
How can I do this?