Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Subject: RE: tail -f and pipes with bash shell Date: Fri, 13 May 2005 01:38:28 +0200 Message-ID: <90459864DAD67D43BDD3D517DEFC2F7D05AF26@axon.Axentia.local> From: "Peter Ekberg" To: "Lev Bishop" , X-IsSubscribed: yes Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id j4CNceX2027576 Lev Bishop wrote: > On 11/05/05, Peter Ekberg wrote: >> What is going on here? > > My guess: "tail frame.log" closes its stdout as soon as it has read > the requested lines from the file, "tail -f frame.log" keeps its > stdout open, since it is waiting for new lines to be added to the > logfile. Cat is using some buffering on its stdin, so it tries to read > a buffer's worth of data at a time. Ah, thanks for the hint! But, the buffering does not seem to happen in cat (or is at least triggered by something external to cat). If I open two cmd window consoles, and in the first one I issue ~$ cat > foobar And in the second one I issue ~$ tail -f foobar | grep d I see all lines entered in the first console on the second console (if they have d in them) with a fairly rapid response time. But if I instead issue this in the second console ~$ tail -f foobar | grep d | grep d I get the buffering effect with high latencies... Also, if I issue this in the second console ~$ tail -f foobar | cat I again get a farily rapid response time. So, the buffering does not seem to be related to cat, but to where in the pipe the process is located, or to the length of the pipe or something. Rather unintuitive, my guess is that it's BYAM... Cheers, Peter -- 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/