0

I have 4 UART devices and I want to watch their output concurrently. I use the following script to do this job:

# first kill the cat process from last run
killall -v cat

for i in `seq 0 3`; do
    cat /dev/crbif0rb0c$(i}ttyS0 | grep . --line-buffered &
    # cat /dev/crbif0rb0c$(i)ttyS0 &
done

But I get no output from this script, except many empty lines. When I remove the grep stuff and use the second line in the for loop, I get a lot of outputs, but not readable since all outputs are messed up.

So my question is why there is no output (except empty lines) when I use grep? Or anyone can provide a better (and workable) solutions for my scenario?

Thanks in advance!

[UPDATE] I suddenly found that cat /dev/crbif0rb0c${i}ttyS0 | grep ^ --line-buffered & will work. Don't know why...

Jinghao Shi
  • 1,077
  • 2
  • 10
  • 15

1 Answers1

1

How about tail -f /dev/crbif0rb0c{0,1,2,3} ?

artbristol
  • 32,010
  • 5
  • 70
  • 103