"cat" only the last line. how?
I want to check a log into terminal, the logger writes a temperature_log in /var/log . How can I <<cat>> only the last line of the log, so I can append it to the output?
Here is the bad code: Code:
#! /bin/bash Code:
echo "`cat_last_line temperature_log`" any suggestions? Edit: the logger updates the log every 5 seconds , thats the "sleep 5" for. |
tail -1 temperature_log
|
use: tail -n XX file
|
5 minutes and 2 answers , thanks a lot.
Thats the new script: Code:
#! /bin/bash |
slow night at work! ;)
|
I think this script might equivalent to
Code:
tail -f /var/log/temperature_log Code:
~$ man tail |
Quote:
|
In that case - you might want to do tail -f 1 "file_name" & instead
|
Re post #4
Code:
until [ x = 1 ]; do |
Doesn't keep the file open ...
|
All times are GMT -5. The time now is 09:18 PM. |