I want to display text output on the console that is always displayed on a small screen on my Raspberry Pi.
The following code works for showing that text output:
cd /home/pi/python_test_scripts_linux && sudo nice -n -20 /home/pi/python_test_scripts_linux/test_wrapper.py > /dev/tty1
Now I want to capture the output in parallel with seeing it on the screen - I have tried 'tee' but that does not show text on the screen and also does not capture it to file:
cd /home/pi/python_test_scripts_linux && sudo nice -n -20 /home/pi/python_test_scripts_linux/test_wrapper.py | tee /dev/tty1 /tmp/capture.txt
How can I redirect the output of my script to /dev/tty1
so I can see it on my screen but also capture the output to file?
UPDATE 1:
Per the answer below - I tried using 'script' - unfortunately it did not work:
script -c "cd /home/pi/python_test_scripts_linux && sudo nice -n -20 /home/pi/python_test_scripts_linux/test_wrapper.py > /dev/tty1" /home/pi/python_test_scripts_linux/report.html
UPDATE 2:
I also tried to 'tail' the output of the file that I redirected the output to into /dev/tty1, but it also did not work:
sudo tail -F /home/pi/python_test_scripts_linux/report.html > /dev/tty1 &
cd /home/pi/python_test_scripts_linux && sudo nice -n -20 /home/pi/python_test_scripts_linux/test_wrapper.py > /home/pi/python_test_scripts_linux/report.html
tee /tmp/capture.txt >/dev/tty1
work?open()
a descriptor in your script and write to it?tee
will onlytee
its stdin. If you can figure out where you are writing then you can dup it. What is up with all of thesudo nice
stuff? You can just tail/dev/vcs1
if you must, but you're doing some weird stuff. Can you drop all of thesudo
stuff and still print?