This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Xargs positioning the arguments in a command -- is this a bug or a feature?


> 
> dir -gGtcr --time-style=+%Y%m%d%X | cut -c 24- | xargs -i -n 2 echo {}
> MORE_STUFF
> 
> ...doesn't work -- i.e., "{}" appears in the output.
> 
> However, reversing the switches does work as expected:
> 
> dir -gGtcr --time-style=+%Y%m%d%X | cut -c 24- | xargs -n 2 -i echo {}
> MORE_STUFF
> 
> I am curious if this is expected behavior as I didn't
> see any warning in the xarg --help or man/info entries.
> 
> It is an unusual command that requires switches to 
> appear in a specific order, especially when the 
> switches are not directly dependent on each other.

The upcoming findutils-4.2.25-1 (whenever upstream releases 4.2.25)
better documents this.  -i is being deprecated in favor of POSIX -I, which
requires an argument, whereas the non-standard -i treated its
argument as optional.  So what may be happening (although you'd
actually have to debug to see for sure) is that -i -n treats -n as the
string to replace, instead of the default {}.  But that sounds odd, and
it may be an upstream bug; I'll investigate further.

--
Eric Blake



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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]