From owner-freebsd-questions@FreeBSD.ORG Fri Feb 2 18:50:52 2007 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 73E2716A400 for ; Fri, 2 Feb 2007 18:50:52 +0000 (UTC) (envelope-from bsdaemon@comcast.net) Received: from sccrmhc15.comcast.net (sccrmhc15.comcast.net [63.240.77.85]) by mx1.freebsd.org (Postfix) with ESMTP id 3BB8113C474 for ; Fri, 2 Feb 2007 18:50:52 +0000 (UTC) (envelope-from bsdaemon@comcast.net) Received: from fw.home (c-68-39-195-31.hsd1.pa.comcast.net[68.39.195.31]) by comcast.net (sccrmhc15) with SMTP id <200702021850510150077at1e>; Fri, 2 Feb 2007 18:50:51 +0000 Received: (qmail 5389 invoked by uid 1003); 2 Feb 2007 18:50:47 -0000 Date: Fri, 2 Feb 2007 13:50:47 -0500 From: Kris Maglione To: Dak Ghatikachalam Message-ID: <20070202185046.GA3073@fw.home> Mail-Followup-To: Dak Ghatikachalam , freebsd-questions@freebsd.org References: <20070131190658.GA49580@fw.home> <20070131202202.GB49580@fw.home> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.13 (2006-08-11) Cc: freebsd-questions@freebsd.org Subject: Re: Korn shell script Question X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Feb 2007 18:50:52 -0000 On Fri, Feb 02, 2007 at 11:10:02AM -0500, Dak Ghatikachalam wrote: >{ while cat /tmp/availspace.$$; do false; done } |& >exec 5<&p >cat /tmp/reprocesses.$$|awk '/DATAFILE/ { print $0 }'|tr -d ' '| >while read file_b >do > read -u5 file_a > echo $file_b $file_a >done >/tmp/reprocessrecset.$$ > >exec 5<&- > >this what you meant ? It doesn't matter where you put the redirects, so long as they're in order and you wind up closing the coprocess's standard output so that it exits. It's more a matter of style and taste than anything. Here are some more options if you're interested: As long as you haven't started any other background jobs, this would work in place of the final 'exec 5<&-': kill -INT %+ Or, after you start the coprocess, you can store its PID, and kill that later: copid=$! ... kill -INT $copid Again, it's a matter of style and taste. If it's not to be part of a long running script, though, don't even worry about it.