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

Stephane Chazelas <[email protected]>
Newsgroups gmane.comp.gnu.findutils.bugs
Message-ID <[email protected]>
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:

  <https://savannah.gnu.org/bugs/?60383>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/
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.