| www.delorie.com/archives/browse.cgi | search |
| Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
| 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 |
| From: | ericblake AT comcast DOT net (Eric Blake) |
| To: | Herb Martin <HerbM AT learnquick DOT com>, cygwin AT cygwin DOT com |
| Subject: | Re: Xargs positioning the arguments in a command -- is this a bug or a feature? |
| Date: | Sun, 28 Aug 2005 00:08:00 +0000 |
| Message-Id: | <082820050008.6266.4311005F000E99680000187A22069984990A050E040D0C079D0A@comcast.net> |
| X-Authenticated-Sender: | ZXJpY2JsYWtlQGNvbWNhc3QubmV0 |
>
> 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/
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |