I'm trying to execute a Python program, redirect its output to a file, and compare the contents of that file to an existing one, all in a single shell command. This is what I have, but of course it's not working:
diff `python3 program.py > redirect_file.txt` compare_file.txt
I'm a Linux noob, so any help in pointing me in the right direction would be great.
The diff command allows you to use a -
on the command line to use stdin, so try:
python3 program.py | diff - compare_file.txt