Domanda

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.

È stato utile?

Soluzione

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
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top