[vox-tech] trouble running recursive grep

Henry House vox-tech@lists.lugod.org
Mon, 11 Mar 2002 14:06:37 -0800


--pY3vCvL1qV+PayAL
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Sun, Mar 10, 2002 at 10:56:29AM -0800, eric nelson wrote:
> Why doesn't this work:
>=20
> (as root)
> cd /usr/src/linux/include
> grep -r pci_dev *.h

It does not work because shell globbing (using *, [], etc) expands the
argument list to the program BEFORE it is invoked. So, for example, 'ls *',
run in a directory where files .aa, aa, ab, and bb exist, is expanded to 'ls
aa ab bb' by my shell, and ls sees three arguments in ARGV. What about .aa?
The POSIX standard specifies that a bare star does not match a leading dot;
to match that, use '.*'.

--=20
Henry House
The attached file is a digital signature. See <http://romana.hajhouse.org/p=
gp>
for information.  My OpenPGP key: <http://romana.hajhouse.org/hajhouse.asc>.

--pY3vCvL1qV+PayAL
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE8jSptKK1cAVjXujwRAjFAAJ45Nhl2f2dMRUYYZiuwKDQYnh2DhACgwMWl
pay2hfM3kthFp2ctngUMaDw=
=qMyj
-----END PGP SIGNATURE-----

--pY3vCvL1qV+PayAL--