[Top][All Lists]

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

[bug #60383] [feature-request] let find read files from stdin or file.

From: Stephane Chazelas
Subject: [bug #60383] [feature-request] let find read files from stdin or file.
Date: Sun, 28 Nov 2021 09:30:41 -0500 (EST)
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Firefox/78.0

Follow-up Comment #15, bug #60383 (project findutils):

Thanks Bernhard. I think it's a more useful API like that.

BTW, would you also consider adding BSD's -f to GNU find?

I don't think POSIX would agreed to specify -files0-from, like they rejected
-print0 on the ground that most POSIX utilities can't cope with NULs anyway,
but given that -f is already in BSDs, if it was added to GNU find, there's a
good chance it would be accepted.

Timing could be good if we're quick as well as the next version of the
standard is due soon, already in 3rd draft stage IIRC.

It would be a good opportunity to at last have a standard way to pass
arbitrary file names to "find".

In BSDs, it's

find -f file predicates
find -f file1 -f file2 predicates
find -f file1 file2 predicates
find -f file1 -- file2 predicates

(files can be passed both with -f and without)

BSD finds don't allow things like "find -print" (no file specified). Still, I
don't think that would be a problem for GNU find. It could accept all the
above, but we just need to clarify that while "file -f file1 file2 -print"
processes file1 and file2 and "find -print"  is the same as "find . -print",
"find -f file1 -print" would *not* be the same as "find -f file1 . -print".

That means however that:

"file -f$array -print" (fish, rc, es syntax) or "find -f$^array -print" (zsh
syntax), "find "${array[@]/#-f}" -print" (ksh/bash) would end up looking up
files in "." (gives an error in BSDs). A caveat worth mentioning.

Note that in:

find -f file1 -H -f file2

The "-H" applies to both file1 and file2 in BSDs. Making it apply to only
file2 could be a more useful API, though only marginally so, and potentially
more surprising.

If you think adding -f is a good idea and would be willing to implement it, I
can write up the request to POSIX to specify it.

It may be worth raising a separate savannah ticket for that. I'm happy to do
that as well.


Reply to this item at:


  Message sent via Savannah

reply via email to

[Prev in Thread] Current Thread [Next in Thread]