Frage

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.

War es hilfreich?

Lösung

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
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top