Path: utzoo!mnetor!tmsoft!torsqnt!news-server.csri.toronto.edu!cs.utexas.edu!yale!cmcl2!kramden.acf.nyu.edu!brnstnd From: brnstnd@kramden.acf.nyu.edu (Dan Bernstein) Newsgroups: comp.unix.questions Subject: Re: redirected output is buffered, how do you flush it? Message-ID: <18404:Feb1023:12:4291@kramden.acf.nyu.edu> Date: 10 Feb 91 23:12:42 GMT References: <1991Feb05.000629.7401@convex.com> <1892:Feb521:11:4591@kramden.acf.nyu.edu> <1991Feb10.081651.24841@uwbln.uniware.de> Organization: IR Lines: 18 In article <1991Feb10.081651.24841@uwbln.uniware.de> jde@uwbln.uniware.de (Jutta Degener) writes: > > Here's a very easy general solution: Run % pty script > some_file > When you hit '^C', both the shell and its subprocess, awk, are killed. > Unfortunately, as Tom already mentioned, awk doesn't flush its buffers. Fortunately, a program running under pty sees a terminal for its input and output, so any program using stdio (including awk) will flush its buffers just as if you ran it without redirection. That's why it's a solution. > trap "" 1 2 3 .. etc will ignore signals for both a shell and its > subprocesses. (On the systems I checked.) That won't solve the poster's problem. He's saying ``output is buffered, so when I kill awk, I lose output.'' Tom and I are saying ``so don't buffer your output.'' You're saying ``so don't kill awk.'' ---Dan