xargs: Why does order of command line switches matter?

Buchbinder, Barry (NIH/NIAID) [E] BBuchbinder@niaid.nih.gov
Wed Apr 25 13:40:00 GMT 2012

On 4/25/2012 6:29 AM, Ronald Fischer wrote:
>Eliot Moss sent the following at Wednesday, April 25, 2012 7:05 AM
>> Why do I get a different output in the following two invocations of
>> xargs? I had expected that the relative order of the command line
>> switches (-I, -L) would not matter:
>> $ ls | xargs -I DIR -L 1 echo DIR
>> DIR wontprint.txt
>> DIR x.cmd
>> DIR x.pl
>> DIR x.sh
>> $ ls | xargs -L 1 -I DIR echo DIR
>> wontprint.txt
>> x.cmd
>> x.pl
>> x.sh
>I agree that that is what happens, and that it does seem strange
>and buggy. I note, though, that -I *implies* -L 1, so the -L 1 is
>unnecessary. Perhaps the explicit mention of -L 1 "kills" the -I flag in
>xarg's command line processing. My guess is that this behavior is passed
>on from the upstream implementation and is not specific to cygwin, which
>means that the appeal for a change would probably need to be lodged
>elsewhere ...

From man xargs:

       The  -L option is incompatible with the -I option, but perhaps should
       not be.

- Barry
  Disclaimer: Statements made herein are not made on behalf of NIAID.

Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

More information about the Cygwin mailing list