I am experiencing an issue whereby I cannot completely redirect output from an executable. For discussion, let’s say the executable is printnames.exe.
If I do printnames.exe (without redirection), the following output is displayed in the command window:
Adam
Tim
Jesse
Sean
However if I do printnames.exe > myfile.txt, the command window shows:
Tim
Sean
…and the contents of myfile.txt is:
Adam
Jesse
How is this possible? What in the code can cause such behavior? Shouldn’t the redirection operator redirect all output?
You have two output streams.
Writing to standard output and also writing to standard error.
No. Default redirection applies to standard output.
Use
2>to redirect standard error.http://www.gnu.org/software/bash/manual/bashref.html#Redirections