From: Eric Blake <eblake@redhat.com>
To: cygwin@cygwin.com
Subject: Re: Calling cygpath from find exec?
Date: Mon, 23 Nov 2015 22:31:00 -0000 [thread overview]
Message-ID: <565383D5.3010709@redhat.com> (raw)
In-Reply-To: <56537B03.4050204@codespunk.com>
[-- Attachment #1: Type: text/plain, Size: 888 bytes --]
On 11/23/2015 01:45 PM, Matt D. wrote:
> Is there a reason why these produce different results?
>
> find . -exec cygpath -wa {} \;
> find . -exec echo $(cygpath -wa {}) \;
Incorrect quoting. You are invoking:
find . -exec echo c:\cygwin\home\you\{} \;
(or whatever ./{} resolves to), instead of one cygpath per name found by
find.
>
> I have to do this which is much slower:
> find . -exec bash -c 'echo $(cygpath -wa {})' \;
>
This indeed quotes things so that cygpath is now invoked once per file,
but at the expense of an additional bash per file as well.
Why not just:
find . -exec cygpath -wa {} +
since cygpath handles more than one file in an invocation (that is,
using '-exec {} +' rather than '-exec {} \;' is generally faster).
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]
next prev parent reply other threads:[~2015-11-23 21:23 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-23 21:14 Matt D.
2015-11-23 21:16 ` Nellis, Kenneth
2015-11-23 22:31 ` Eric Blake [this message]
2015-12-01 20:43 ` Duncan Roe
2015-12-01 20:52 ` Eric Blake
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=565383D5.3010709@redhat.com \
--to=eblake@redhat.com \
--cc=cygwin@cygwin.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).