Вопрос

I would like to pipe log file with tail -f but only the last line. My command is

tail -f logfile.log | while read line; do /usr/bin/gammu --sendsms TEXT ****** -text "$line"; done

I saw that I can use grep --line-buffered but my new line can't have any char and with what I have tried it doesn't work.

Это было полезно?

Решение

The error shows the problem is other place, which you don't show to us. Below test code is fine for me.

tail -1f logfile.log | while read line
do 
   echo /usr/bin/gammu --sendsms TEXT ****** -text "$line"
done
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top