[bug #62043] The xargs -r, --no-run-if-empty Option Is Ignored When a Delimiter Is Passed

James Youngman <[email protected]>
Newsgroups gmane.comp.gnu.findutils.bugs
Message-ID <[email protected]>
Follow-up Comment #5, bug #62043 (project findutils):

Andreas writes:

OTOH I am trying to fix the documentation of xargs' inconsistent behavior,
imho these two commands should produce identical output both for consistency
reasons and according to the documentation but do not:
printf '\n' | xargs -r echo foo
printf '\0' | xargs -0 echo foo

These are not supposed to behave similarly.  In its default mode (without -d
or -0), xargs does whitespace and quote processing.  Like so:

horizon:~$ printf 'one "item two is long" three' | xargs   -n1 echo foo
foo one
foo item two is long
foo three
horizon:~$ printf 'one "item two is long" three' | xargs   -n1  -d '\n' echo
foo
foo one "item two is long" three

So the input "\n" has contains one (empty) arg with -d "\n" and contains no
args in the default mode, and contains one arg (a newline) with -0.

You're right though; if the documentation does not make this clear, we should
fix the documentation.




    _______________________________________________________

Reply to this item at:

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

_______________________________________________
  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.