[Top][All Lists]

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

[bug #52137] unexpected behaviour when combining -I and -n

From: Andreas Metzler
Subject: [bug #52137] unexpected behaviour when combining -I and -n
Date: Sun, 1 Oct 2017 12:42:08 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:55.0) Gecko/20100101 Firefox/55.0

Follow-up Comment #3, bug #52137 (project findutils):


agreed regarding addition of warning and doc-update.

> "But I cannot see posix requiring that -I and -n must produce
> strange results, so xargs could go beyond posix and produce
> correct results in that case anyway."

Actually POSIX saying that -I and -n are mutually exclusive is not arbitrary.
The specification of -I and -n cannot be fullfilled at same time, except for
the degenerate case (one line with a single argument):

-I [...] utility is executed for each logical line from standard input. 
Arguments in the standard input shall be separated only by unescaped [newline]
characters, not by [blank] characters.
-n [...] Invoke utility using as many standard input arguments as possible, up
to number arguments maximum.

Therefore because POSIX requires this behavior ...

address@hidden:/tmp$ echo a b | xargs -n1 echo x
x a
x b
address@hidden:/tmp$ echo a b | xargs -I {}  echo x {}
x a b

... mixing -L and -n *must* produce strange results (or an error).


Reply to this item at:


  Message sent via/by Savannah

reply via email to

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