delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2012/04/25/07:05:14

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-2.9 required=5.0 tests=AWL,BAYES_00,KHOP_THREADED,T_RP_MATCHES_RCVD
X-Spam-Check-By: sourceware.org
Message-ID: <4F97DA45.9050100@cs.umass.edu>
Date: Wed, 25 Apr 2012 07:04:37 -0400
From: Eliot Moss <moss AT cs DOT umass DOT edu>
Reply-To: moss AT cs DOT umass DOT edu
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:11.0) Gecko/20120327 Thunderbird/11.0.1
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: xargs: Why does order of command line switches matter?
References: <1335349788 DOT 2627 DOT 140661067092681 DOT 0CBF054A AT webmail DOT messagingengine DOT com>
In-Reply-To: <1335349788.2627.140661067092681.0CBF054A@webmail.messagingengine.com>
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

On 4/25/2012 6:29 AM, Ronald Fischer wrote:
> 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
>
>
> xargs (GNU findutils) 4.5.9
> Packaged by Cygwin (4.5.9-2)

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

Eliot Moss

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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019