$line command problem

Hi all!

I have a problem with line command. The aim is to write each line of stdin into a text file.

For example with this command:

$find /
/usr/share/zoneinfo/WET
/usr/share/zoneinfo/Zulu
/usr/share/zoneinfo/iso3166.tab
/usr/share/zoneinfo/localtime
/usr/share/zoneinfo/zone.tab
/usr/src
/initrd.img
/vmlinuz

I want to write in a file the always the last line printed to stdin, to real-time follow proces execution.

I tried this:

$find / | line > stdout.file       (no results, only write the first line and exit)
$find / | tail -f -n 1 > stdout.file       (no results, only write the last line and exit)

Any ideas?
Thank you very much

Can you re state your problem. First you are saying that you want to print each line then you are saying only last line...

Try something like this :

find / |
while read line
   echo $line > stdout.file
done

The stdout.file will allways contains the last line printed by find on stdout

Jean-Pierre.

Thank you Jean-Pierre, the correct code that works is:

find / |
while read line ; do
   echo $line > stdout.file
done

Thank you very much!