From owner-freebsd-hackers@FreeBSD.ORG Sat Mar 17 22:47:52 2007 Return-Path: X-Original-To: freebsd-hackers@freebsd.org Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 1A67416A40D for ; Sat, 17 Mar 2007 22:47:52 +0000 (UTC) (envelope-from jimmy@mammothcheese.ca) Received: from smtp100.rog.mail.re2.yahoo.com (smtp100.rog.mail.re2.yahoo.com [206.190.36.78]) by mx1.freebsd.org (Postfix) with SMTP id AC2C613C4BE for ; Sat, 17 Mar 2007 22:47:51 +0000 (UTC) (envelope-from jimmy@mammothcheese.ca) Received: (qmail 42672 invoked from network); 17 Mar 2007 22:21:11 -0000 Received: from unknown (HELO ?74.110.53.6?) (jazzturk@rogers.com@74.110.53.6 with plain) by smtp100.rog.mail.re2.yahoo.com with SMTP; 17 Mar 2007 22:21:11 -0000 X-YMail-OSG: m56Q5XYVM1khSZrBRm9luudmZlYZRnjzPt3tr.x0pLiKYWLmiA9bZAdN7zSZmU3oFw-- Message-ID: <45FC69D5.3010406@mammothcheese.ca> Date: Sat, 17 Mar 2007 18:21:09 -0400 From: James Bailie User-Agent: Thunderbird 1.5.0.9 (X11/20061230) MIME-Version: 1.0 To: Garrett Cooper References: <45FC61FF.3090009@u.washington.edu> In-Reply-To: <45FC61FF.3090009@u.washington.edu> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: freebsd-hackers@freebsd.org Subject: Re: Possible grep(1) bug or user error :)? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 17 Mar 2007 22:47:52 -0000 Garrett Cooper wrote: > grep -ri {key} * > {key}.found > > The thing is that grep kept on feeding off of the {key}.found file and > eventually ate up all the free space on the device (~12GB). The shell is redirecting stdout onto the found file before it is expanding the glob patterns, so the found file is being included in the expansion. You can force the expansion to occur first if you assign it to a variable: sh: FILES=*; grep -ri key $FILES > found csh: set FILES=*; grep -ri key $FILES > found Hope this helps, -- James Bailie http://www.mammothcheese.ca