0

I have been attempting to do something like:

dune runtest > test.txt

However, whenever I attempt this an empty test.txt file is created. I would like for the output of dune runtest to be saved into test.txt, and ideally for the Terminal to not output anything (the output is only able to be viewed in the file). Any help would be appreciated.

1 Answers1

0

dune runtest most likely writes to stderr, and > will only redirect stdout.

To only redirect stderr:

dune runtest 2> test.txt

To redirect both stdout and stderr:

dune runtest > test.txt 2&>1

where 2&>1 means "redirect stderr to stdout".

Some shells also support this short-hand for the above:

dune runtest &> test.txt
glennsl
  • 28,186
  • 12
  • 57
  • 75