I have a bunch of executable files and I want to store the output of each one of them in a separate file.
For that purpose i am using following command but "2>&1" does not work every time. And sometimes the output files remain empty even though the script does print stuff in shell when run from shell.
What should I use instead of 2>&1?
./$file 2>&1 | tee "$outputFile"
Some executables don't just write to stdout and stderr, but instead open /dev/tty and write to that.
So to redirect those it is necessary to do more complicated procedures involving a psuedo-tty. See the command script, for something that can do this.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With