read tty while writing to a file

(how can i merge the following to playground/LinuxTTY?)

cat </dev/ttyACM0 > test |tee or

tee test < /dev/ttyACM0

EDIT1: the above don’t always work. I’m trying to find a way to use tee

I’ll stick with :
cu -l /dev/ttyACM0 -s 9600 | tee temp.txt which can be stopped with :
pkill cu.

Now, the DRAWBACKS are :

  • it doesn’t stop with Ctrl+c
  • it needs some cleanup in the head and the tail

EDIT3: to clean up just do :
head -n -4 temp.txt > output.txt afterwards :slight_smile: