From owner-freebsd-questions@FreeBSD.ORG Fri Feb 2 19:27:33 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 75C8D16A402 for ; Fri, 2 Feb 2007 19:27:33 +0000 (UTC) (envelope-from dghatikachalam@gmail.com) Received: from wx-out-0506.google.com (wx-out-0506.google.com [66.249.82.238]) by mx1.freebsd.org (Postfix) with ESMTP id 163FF13C4A6 for ; Fri, 2 Feb 2007 19:27:32 +0000 (UTC) (envelope-from dghatikachalam@gmail.com) Received: by wx-out-0506.google.com with SMTP id s18so959216wxc for ; Fri, 02 Feb 2007 11:27:22 -0800 (PST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; b=WmK3mA3Nn5CBWcpLV/NujiIrgTjCBZTEbsmF6ZkF+I5eWXRb+2/O0yr+FnYvTD6vqa4HiveyipUdfBfMhO7k6IYOgG0YmAFOz4Yqu8ymBmH4KJzE1GETp3CuTwprRjvBCgt6C4aqWeOHnB8Vb903rX0juFDh5a86XEJZLdLlfwI= Received: by 10.70.39.5 with SMTP id m5mr6737227wxm.1170444026708; Fri, 02 Feb 2007 11:20:26 -0800 (PST) Received: by 10.70.52.12 with HTTP; Fri, 2 Feb 2007 11:20:26 -0800 (PST) Message-ID: Date: Fri, 2 Feb 2007 14:20:26 -0500 From: "Dak Ghatikachalam" To: freebsd-questions@freebsd.org In-Reply-To: <20070202185046.GA3073@fw.home> MIME-Version: 1.0 References: <20070131190658.GA49580@fw.home> <20070131202202.GB49580@fw.home> <20070202185046.GA3073@fw.home> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Content-Filtered-By: Mailman/MimeDel 2.1.5 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 19:27:33 -0000 On 2/2/07, Kris Maglione wrote: > > 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. > Kris, That is great , Thanks a lot for your input and insight. It just amazes me how powerful a korn shell script in general any Unix shell, process handling can be. Thanks Dak