Discussion:
ls.1: incorrect -O flag description
(too old to reply)
t***@kergis.com
2024-10-10 19:37:15 UTC
Permalink
The -O (not a POSIX one) flag seems incorrectly described in the manual
page.

What it does (from a cursory look at the sources, matching the result
of testing), is simply not displaying a supplementary information
about the directory traversed when going recursive.

It does not output only leaf (filenames not directory). This is only
the "headline": "\ndir:\n" that is not displayed.

Just try:

$ ls -OF

for example (and combine with -R).

What was the intention of the flag? To have an output with just the
names (including directories) without the formatting about the newline
and the dir?
--
Thierry Laronde <tlaronde +AT+ kergis +dot+ com>
http://www.kergis.com/
http://kertex.kergis.com/
Key fingerprint = 0FF7 E906 FBAF FE95 FD89 250D 52B1 AE95 6006 F40C

--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-***@muc.de
Valery Ushakov
2024-10-11 02:35:11 UTC
Permalink
Post by t***@kergis.com
The -O (not a POSIX one) flag seems incorrectly described in the manual
page.
What it does (from a cursory look at the sources, matching the result
of testing), is simply not displaying a supplementary information
about the directory traversed when going recursive.
It does not output only leaf (filenames not directory). This is only
the "headline": "\ndir:\n" that is not displayed.
$ ls -OF
for example (and combine with -R).
What was the intention of the flag? To have an output with just the
names (including directories) without the formatting about the newline
and the dir?
revision 1.71
date: 2014-02-20 22:56:36 +0400; author: christos; state: Exp; lines: +18 -8;
Add -O (only leaf files) and -P (print full path), from tls@

Seems buggy too

$ mkdir -p 1/2/3/4
$ touch 1/2/200
$ find .
.
./1
./1/2
./1/2/3
./1/2/3/4
./1/2/200
$ ls -RPO
./1
./1/2
./1/2/200./1/2/3
./1/2/3/4

Can you file a PR, please? TIA.

-uwe

--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-***@muc.de
Valery Ushakov
2024-10-11 15:41:20 UTC
Permalink
Hi, Thor.

Do you remember what was the original intention behind ls -O?
Post by t***@kergis.com
Post by Valery Ushakov
Post by t***@kergis.com
The -O (not a POSIX one) flag seems incorrectly described in the manual
page.
What it does (from a cursory look at the sources, matching the result
of testing), is simply not displaying a supplementary information
about the directory traversed when going recursive.
It does not output only leaf (filenames not directory). This is only
the "headline": "\ndir:\n" that is not displayed.
$ ls -OF
for example (and combine with -R).
What was the intention of the flag? To have an output with just the
names (including directories) without the formatting about the newline
and the dir?
revision 1.71
date: 2014-02-20 22:56:36 +0400; author: christos; state: Exp; lines: +18 -8;
Seems buggy too
$ mkdir -p 1/2/3/4
$ touch 1/2/200
$ find .
.
./1
./1/2
./1/2/3
./1/2/3/4
./1/2/200
$ ls -RPO
./1
./1/2
./1/2/200./1/2/3
./1/2/3/4
Can you file a PR, please? TIA.
Done: bin/58740
And for me the solution is to suppress the flag altogether---what
the manpage says it is supposed to do can be done with find(1).
-uwe

--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-***@muc.de
t***@kergis.com
2024-10-11 11:16:32 UTC
Permalink
Post by Valery Ushakov
Post by t***@kergis.com
The -O (not a POSIX one) flag seems incorrectly described in the manual
page.
What it does (from a cursory look at the sources, matching the result
of testing), is simply not displaying a supplementary information
about the directory traversed when going recursive.
It does not output only leaf (filenames not directory). This is only
the "headline": "\ndir:\n" that is not displayed.
$ ls -OF
for example (and combine with -R).
What was the intention of the flag? To have an output with just the
names (including directories) without the formatting about the newline
and the dir?
revision 1.71
date: 2014-02-20 22:56:36 +0400; author: christos; state: Exp; lines: +18 -8;
Seems buggy too
$ mkdir -p 1/2/3/4
$ touch 1/2/200
$ find .
.
./1
./1/2
./1/2/3
./1/2/3/4
./1/2/200
$ ls -RPO
./1
./1/2
./1/2/200./1/2/3
./1/2/3/4
Can you file a PR, please? TIA.
Done: bin/58740

And for me the solution is to suppress the flag altogether---what
the manpage says it is supposed to do can be done with find(1).
--
Thierry Laronde <tlaronde +AT+ kergis +dot+ com>
http://www.kergis.com/
http://kertex.kergis.com/
Key fingerprint = 0FF7 E906 FBAF FE95 FD89 250D 52B1 AE95 6006 F40C

--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-***@muc.de
Loading...