From owner-freebsd-questions@FreeBSD.ORG Mon Feb 4 15:54:59 2008 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6586116A474 for ; Mon, 4 Feb 2008 15:54:59 +0000 (UTC) (envelope-from regnans@gmail.com) Received: from fg-out-1718.google.com (fg-out-1718.google.com [72.14.220.155]) by mx1.freebsd.org (Postfix) with ESMTP id E406013C4E8 for ; Mon, 4 Feb 2008 15:54:58 +0000 (UTC) (envelope-from regnans@gmail.com) Received: by fg-out-1718.google.com with SMTP id 16so2137614fgg.35 for ; Mon, 04 Feb 2008 07:54:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:user-agent:mime-version:to:cc:subject:references:in-reply-to:content-type:content-transfer-encoding; bh=mS62QtUwqkXh9qBAcFeRfw/azxtTf2AUP6h73Pg04Ls=; b=AlPzfwH6iFlFuO5db3uW81F7qno8Oer3/Y4SbFoY2oOZSjchWwn2CSDQZtlWfboaPjUyKhxIxU3htHt+OZTgwa+l/n9Xub16eVIvpCjpAngBBJjxqcQKGS5y4L2WaT1pBh0dz9D/brV8frGa4ZnL/fAB/ael+6swMrMuS1Iu9L4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:cc:subject:references:in-reply-to:content-type:content-transfer-encoding; b=YksuxM/0FINsEbO6vfdSJ9rwq0+GKQt368w2V5tykF5W7Z+GHPLC0UGzhQpQgIX8lozhmaCbxWk2BweJ1xaqpCAFQ+sLFcXRQYD58Kb7cma+9Lz/aaP3AA5fwp5utKgGJzsultszltPnURdSYwUGIIX1o7itX1pVePk0Nt8zewU= Received: by 10.86.90.2 with SMTP id n2mr6700675fgb.66.1202138952204; Mon, 04 Feb 2008 07:29:12 -0800 (PST) Received: from ?192.168.2.40? ( [212.168.164.203]) by mx.google.com with ESMTPS id d4sm7688888fga.2.2008.02.04.07.29.10 (version=TLSv1/SSLv3 cipher=RC4-MD5); Mon, 04 Feb 2008 07:29:11 -0800 (PST) Message-ID: <47A72F3B.7030902@gmail.com> Date: Mon, 04 Feb 2008 16:28:59 +0100 From: h p User-Agent: Thunderbird 2.0.0.9 (X11/20071210) MIME-Version: 1.0 To: Wojciech Puchar References: <20080204161647.V8347@wojtek.tensor.gdynia.pl> In-Reply-To: <20080204161647.V8347@wojtek.tensor.gdynia.pl> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: freebsd-questions@freebsd.org Subject: Re: bash bug - or what? 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: Mon, 04 Feb 2008 15:54:59 -0000 Wojciech Puchar wrote: > look at this > > $SORT is sort -S 512m > > $tmp2 is input filename (being 2GB size), $tmp3 is output > > this fragment tries (with success) to randomize lines from $tmp2 and > write it to $tmp3 > > while read ll;do > echo $RANDOM $RANDOM $ll > done <$tmp2 | $SORT |cut -f 3- -d " " >$tmp3 > > > > this works but why bash sucks VM space? > > 69274 test 1 -8 0 1862M 98008K pipewr 1 8:17 > 40.28% bash > > > this 1862 is growing until it finishes, resident size is 100M because > it gets swapped out. > > > it looks like echo'ed data is kept in bash memory I think that's the way it should be, because sort needs the whole output of the loop before it can begin sorting.