I have an Arduino sending data over a serial port to my Ubuntu PC. This is working as I can open a serial monitor on the PC and view the data. The arduino sends one line of data every 2 seconds. I want to redirect the output to a text file on the PC. I tried:
(stty raw; cat > /home/me/received.txt) < /dev/ttyUSB2
It works but it appends each line received to the file. I want it to over write the file each time. In other words, the file should only ever have one line of data in it which would be the newest received.
I thought the < vs << would take care of that but obviously I am missing something. Can anyone point me in the right direction?