tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

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



> 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


Home | Main Index | Thread Index | Old Index