Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 30 Jun 2014 07:23:31 +0100
From:      Matthew Seaman <m.seaman@infracaninophile.co.uk>
To:        freebsd-questions@freebsd.org
Subject:   Re: long string using find and "-exec ls -ls" to find part-of filename
Message-ID:  <53B10263.7050808@infracaninophile.co.uk>
In-Reply-To: <53B0FA11.8020808@calorieking.com>
References:  <20140630045605.GA11147@ethic.thought.org> <53B0EFF2.80205@calorieking.com> <20140630052410.GA16901@ethic.thought.org> <53B0FA11.8020808@calorieking.com>

next in thread | previous in thread | raw e-mail | index | archive | help
This is an OpenPGP/MIME signed message (RFC 4880 and 3156)
--qllOkQrj2wfEBK1juwi5LRSOcBIsNLLoo
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

On 30/06/2014 06:48, Gregory Orange wrote:
>>     yup.  then WHY O WHY O WHY doesnt this work::
>>     find . -name "foo.t*" |xargs ls -lsi
>>     work?  is it only my memory [[delusional] that made me think that
>>     "foo.t*" expanded into your cmd string??  I thought the "*"
>>     expanded into what you have to save the hacker typing/keystrokes.
>=20
> Curiously your command line works for me on both an Ubuntu (sh, bash)
> machine and a FreeBSD (sh, bash, csh, tcsh) machine. I would have
> expected the shell to expand * to and cause find to return an error, bu=
t
> it appears not. Perhaps it depends on the shell? It works for me on the=

> shells listed above.

No -- it's find(1) that does the globbing expansion there.  That's why
you need to put quote marks around the wildcard term; to stop the shell
trying to process it.  The shell is irrelevant.

One reason this sort of command may not work as expected is if you're
outputing filenames with spaces or other characters of syntactic
significance to the shell.  If you have those sorts of filenames, the
solution is:

   find . -name "foo.t*" -print0 | xargs -0 ls -lsi



--=20
Dr Matthew J Seaman MA, D.Phil.

PGP: http://www.infracaninophile.co.uk/pgpkey
JID: matthew@infracaninophile.co.uk


--qllOkQrj2wfEBK1juwi5LRSOcBIsNLLoo
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.20 (Darwin)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQJ8BAEBCgBmBQJTsQJvXxSAAAAAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25zLm9w
ZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXQ2NTNBNjhCOTEzQTRFNkNGM0UxRTEzMjZC
QjIzQUY1MThFMUE0MDEzAAoJELsjr1GOGkATEwQQAIc1v9Wx+KyUJ4oVsNk92I+N
4tVDwAHzYjy3UPVU2zTa3udeYLJeROoYCjKFHX6VnnanfQYvFYl+nggtpj5k/tqd
jtdFd8L67M/J6wudbAGKaxHL+Ica0xPVSJRQrsEK19wQW+hpKTT+B0iLzxRE5fFd
paw7uP6HGJdxs/MbyduQ8YigyMtX/KL43o22Mfp2cseilFOUEvBH6aVYuzSIMjsF
CGiTSVIjn2NCtKlVWhhlLrqvAQ0xz9WdhDtxjV8stLawv5NMdyiHQoiZpeS9m65U
HIK6G8wK4wEGz9iWr7c5hUOB1WXR79ltp8B5tpNcnpBdnhWGstshQmV9iKPQTb2c
IF6OJmznyuwSZmNUv6WJQmflkLeozWOuQsFNyTU8F9zIOwaduDFDnh9Oi36lbHoY
DW9c0sKHPmUGVWkD/U6uxTFfFmc0LAZ450Hhv0rRw1C/bcz7cDuf8oSzsAkGhbGe
XfDFs7QDyqQiARui3SoXpVFlwSeq1hMAjhAgk0pPPo6zEYV6LdxFty25gNFoA/tZ
yAKktCzJIWlouzTxSqeZNXnLakC5YI007ZDT6d2amaRFUlVB5Ru5DLufJbulQrcX
+EK1t/omq3HOpb+E/AIG2of/9iUpQtFhgCDmLZxr7NRfrb8BxbCvnfG2cKnS03YW
xyrnm9IzpFQ04Qmm2h2J
=QRNU
-----END PGP SIGNATURE-----

--qllOkQrj2wfEBK1juwi5LRSOcBIsNLLoo--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?53B10263.7050808>