ls -l total bug?
Dan Nelson
dnelson at allantgroup.com
Mon Feb 16 12:19:27 PST 2004
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 at allantgroup.com
More information about the freebsd-questions
mailing list