'How do i copy the output from ttyS0 to a file but still see it on ttyS0 in Putty

I can use this to send ttyS0 to a log.txt file at the beginning of the script

exec >> /mnt/Carousel_Games/systeminfo/pcuae-log.txt
    exec 2>&1

thats ok but now it will not show ttyS0 on Putty, I can use this instead

exec >> /dev/ttyS0
    exec 2>&1

And it will show it on Putty but not in the log.txt.

Is there a way of getting it to do both, show it on Putty plus send it to the log.txt file...? Its so I can see it booting on ttyS0 and I can look at the log.txt file if I need too, if someone is having a problem with it booting properly, I can see it booting on there machine with the log.txt file they send me.



Solution 1:[1]

One way to do it is to open another terminal and tail your file in which the data is being written:

tail -f /mnt/Carousel_Games/systeminfo/pcuae-log.txt

Then, from 2nd terminal, run your command (or your script containing command):

exec >> /mnt/Carousel_Games/systeminfo/pcuae-log.txt

and your 1st terminal will show you what's being coming into the file.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Pratik Panchal