Re: `ls -1s` doesn't print "total"

Mouse <[email protected]>
Newsgroups gmane.os.netbsd.devel.userlevel
Message-ID <[email protected]>
> I'd say -1 is the option for "the output is meant to read
> programmatically" and [its] antonym is -C for "the output for human
> consumption".

That's plausible, but, yes, I agree that in that case the manpage's
descriptions are inaccurate.

> If ls outputs to a pipe it infers -1 automatically unless -C is
> specified

Actually, not "to a pipe" but "to a non-tty", in my experience.

> The total is "for human consumption" (phrased as "the output is to a
> terminal"), so when you specify -1 you turn that off.

Possibly.

For what it's worth, it appears this behaviour is very longstanding.  I
find that 1.4T and 5.2 behave identically in this respect and are
consistent with the "programmatic consumption versus human consumption"
interpretation.  In a directory containing three empty files named one,
two, and three:

ls -s
ls -sC
ls -sC | cat
	total 0
	0 one   0 three 0 two
ls -s | cat
ls -s1
ls -s1 | cat
	0 one
	0 three
	0 two

					Mouse
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.