From owner-freebsd-questions@FreeBSD.ORG Mon Feb 16 12:19:27 2004 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id CC37D16A4CE for ; Mon, 16 Feb 2004 12:19:27 -0800 (PST) Received: from dan.emsphone.com (dan.emsphone.com [199.67.51.101]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7FD4843D1D for ; Mon, 16 Feb 2004 12:19:27 -0800 (PST) (envelope-from dan@dan.emsphone.com) Received: (from dan@localhost) by dan.emsphone.com (8.12.10/8.12.10) id i1GKJQRb003553; Mon, 16 Feb 2004 14:19:26 -0600 (CST) (envelope-from dan) Date: Mon, 16 Feb 2004 14:19:26 -0600 From: Dan Nelson To: Feodor Trubetskoy Message-ID: <20040216201926.GH15700@dan.emsphone.com> References: <40310509.5080306@ispol.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <40310509.5080306@ispol.com> X-OS: FreeBSD 5.2-CURRENT X-message-flag: Outlook Error User-Agent: Mutt/1.5.6i cc: freebsd-questions@freebsd.org Subject: Re: ls -l total bug? X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Feb 2004 20:19:27 -0000 In the last episode (Feb 16), Feodor Trubetskoy said: > ls man reads: > > -l *If the output is to a terminal, a total sum for all > the file sizes is output on a line before the long listing.* > > But I have found that ls consistently put "total" in a first line even > if output is piped or redirected. As an example: > > ls -l | cat > > Is it bug or I missed something? The X/Open spec doesn't say anything about suppressing the "total" line when not sending to a terminal, so I'd say it's a documentation bug. If any of the -l, -g, -n, -o, or -s options is specified, each list of files within the directory shall be preceded by a status line indicating the number of file system blocks occupied by files in the directory in 512-byte units, rounded up to the next integral number of units, if necessary. In the POSIX locale, the format shall be: "total %u\n", -- Dan Nelson dnelson@allantgroup.com