From owner-freebsd-questions@FreeBSD.ORG Mon Jun 30 06:23:54 2014 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 6E1256D6 for ; Mon, 30 Jun 2014 06:23:54 +0000 (UTC) Received: from smtp.infracaninophile.co.uk (smtp6.infracaninophile.co.uk [IPv6:2001:8b0:151:1:3cd3:cd67:fafa:3d78]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "smtp.infracaninophile.co.uk", Issuer "ca.infracaninophile.co.uk" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 11ED22219 for ; Mon, 30 Jun 2014 06:23:53 +0000 (UTC) Received: from seedling.black-earth.co.uk (seedling.black-earth.co.uk [81.2.117.99]) (authenticated bits=0) by smtp.infracaninophile.co.uk (8.14.9/8.14.9) with ESMTP id s5U6NhIZ016094 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO) for ; Mon, 30 Jun 2014 07:23:44 +0100 (BST) (envelope-from m.seaman@infracaninophile.co.uk) Authentication-Results: lucid-nonsense.infracaninophile.co.uk; dmarc=none header.from=infracaninophile.co.uk DKIM-Filter: OpenDKIM Filter v2.9.2 smtp.infracaninophile.co.uk s5U6NhIZ016094 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=infracaninophile.co.uk; s=201001-infracaninophile; t=1404109424; bh=3Dbe4cii8CPn51Eaa6yaY+DfHgMrXxDnGlLbakULrvU=; h=Date:From:To:Subject:References:In-Reply-To; z=Date:=20Mon,=2030=20Jun=202014=2007:23:31=20+0100|From:=20Matthew =20Seaman=20|To:=20freebsd-questi ons@freebsd.org|Subject:=20Re:=20long=20string=20using=20find=20an d=20"-exec=20ls=20-ls"=20to=20find=20part-of=20filename|References :=20<20140630045605.GA11147@ethic.thought.org>=20<53B0EFF2.80205@c alorieking.com>=20<20140630052410.GA16901@ethic.thought.org>=20<53 B0FA11.8020808@calorieking.com>|In-Reply-To:=20<53B0FA11.8020808@c alorieking.com>; b=VDiZVbUb2dSXcE8RtSHPxDtUn9f6Q5lcuhYRleQ5IiWpVHnP5dHlPt+td/NzTuC2c 9hBHe6SvseptK5Q5FRjYpKl7nnMACJcESnU6TBMuItuvePF/Ci9N9xtaeRsW6DLuvl o7l0PaGMQaRBAg2ZwIIGje5sEqSQBSwjX4dk+KpU= Message-ID: <53B10263.7050808@infracaninophile.co.uk> Date: Mon, 30 Jun 2014 07:23:31 +0100 From: Matthew Seaman User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 MIME-Version: 1.0 To: freebsd-questions@freebsd.org Subject: Re: long string using find and "-exec ls -ls" to find part-of filename References: <20140630045605.GA11147@ethic.thought.org> <53B0EFF2.80205@calorieking.com> <20140630052410.GA16901@ethic.thought.org> <53B0FA11.8020808@calorieking.com> In-Reply-To: <53B0FA11.8020808@calorieking.com> X-Enigmail-Version: 1.6 OpenPGP: id=E7F39EBF Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="qllOkQrj2wfEBK1juwi5LRSOcBIsNLLoo" X-Virus-Scanned: clamav-milter 0.98.3 at lucid-nonsense.infracaninophile.co.uk X-Virus-Status: Clean X-Spam-Status: No, score=-2.6 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lucid-nonsense.infracaninophile.co.uk X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Jun 2014 06:23:54 -0000 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--