0

I have tried redirecting the terminal output to a file using tee and > as in the examples here and the question. It worked for echo test | tee log.txt or ls -l | tee log.txt

But It does not work (does not add anything to the log.txt) when I run a command like divine verify file.dve | tee log.txt where divine is an installed tool. Any ideas or alternatives?

Community
  • 1
  • 1
Sami
  • 7,797
  • 18
  • 45
  • 69

2 Answers2

2

Try divine verify file.dve 2>&1 | tee log.txt. If the program is outputting to stderr instead of stdout, this redirects stderr to stdout.

AlexDev
  • 4,049
  • 31
  • 36
-1

works on ffmpeg output too

{ echo ffmpeg -i [rest of command]; ffmpeg -i [rest of command]; } 2>&1 | tee ffmpeg.txt

and tee -a to append if file already exists

======

also if you want to see mediainfo on all files in a folder and make sure command is also visible in mediainfo.txt

{ echo mediainfo *; mediainfo *; } 2>&1 | tee mediainfo.txt

NB: { echo cmd; cmd; } means the command is kept in the txt file ; without this it is not printed

shantiq
  • 101
  • 3