[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: Sat, 20 Nov 2021 08:05:43 -0500 (EST)
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:94.0) Gecko/20100101 Firefox/94.0

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

I very much welcome that new feature, as that at last fixes the long standing
issue that you can't pass arbitrary file paths to "find" (such as "-my-file-",
"(", "!" which you need to prefix with ./ as a work around, see also the
(clunkier to use) -f option of BSDs for that).

Now, I can do (in Korn-like shells):

find -files0-from <(printf '%s\0' "${files[@]}") ... -print0 |
  find -files0-from - ...

And be sure none of the files in the $files array will be taken as a find
option or predicate.

My only problem is that, when find is fed an empty list, we get a

find: file with starting points is empty: ‘(standard input)’

error (and a non zero exit status). I'd rather find not complained about it
there, just like when it doesn't find any file or when using xargs -r0.

I can work around it using moreutils' ifne command as in:

(( ${#files[@]} == 0 )) ||
  find -files0-from <(printf '%s\0' "${files[@]}") ... |
    ifne find -files0-from - ...

But I'd rather avoid that dependency on a non-GNU utility.

What do you think? Should I raise it as a separate bug here?


Reply to this item at:


  Message sent via Savannah

reply via email to

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