سؤال

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