Date: Mon, 16 Feb 2004 14:19:26 -0600 From: Dan Nelson <dnelson@allantgroup.com> To: Feodor Trubetskoy <fedya@ispol.com> Cc: freebsd-questions@freebsd.org Subject: Re: ls -l total bug? Message-ID: <20040216201926.GH15700@dan.emsphone.com> In-Reply-To: <40310509.5080306@ispol.com> References: <40310509.5080306@ispol.com>
next in thread | previous in thread | raw e-mail | index | archive | help
In the last episode (Feb 16), Feodor Trubetskoy said:
> ls man reads:
>
> -l <skip> *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", <number of units in the directory>
--
Dan Nelson
dnelson@allantgroup.com
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040216201926.GH15700>
