From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25342 invoked by alias); 19 May 2004 15:11:08 -0000 Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com Received: (qmail 25321 invoked from network); 19 May 2004 15:11:07 -0000 Received: from unknown (HELO bacon.hamjudo.com) (64.32.216.34) by sourceware.org with SMTP; 19 May 2004 15:11:07 -0000 Received: from hamjudo.com (hamjudo.com [192.168.1.134]) by hamjudo.com (8.12.11.Beta0/8.12.11.Beta0/Debian-1) with ESMTP id i4JFB6Uo009445 for ; Wed, 19 May 2004 11:11:06 -0400 Date: Wed, 19 May 2004 17:42:00 -0000 From: Paul Haas Reply-To: paulh@hamjudo.com To: cygwin@cygwin.com Subject: Re: tail and win file handling Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-SW-Source: 2004-05/txt/msg00683.txt.bz2 Larry Hall wrote: > the file deleted by "rm" isn't deleted really until it's closed, which > won't happen until 'tail' ends. This is the way Windows works. There's > not much to be done about it (at least not in Cygwin). Believe me, > we've tried. Here is a really ugly kludge to deal with a really ugly file system. I'm sure I read about this sort of kludge before, so the idea is certainly not original. -------Cut here------ #!/usr/bin/perl -w # this acts sort of like tail -f, but doesn't keep the # open. It is designed for non-unix systems where open files # can't be deleted. # It mindlessly shows the last 512 bytes of the file on startup # rather than the last 10 lines. # # Paul Haas, May 19, 2004 my $file = shift; open(TF,$file) || die "Reading $file $!"; seek(TF,-512,2); @lines=; my $curpos=tell(TF); close(TF); print @lines; sleep 1; while(-r $file ) { open(TF,$file) || die "Rereading $file $!"; seek(TF,$curpos,0); @lines=; $curpos = tell(TF); print @lines; close(TF); sleep 1; } -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/