[vox-tech] Bash scripting newbie - need syntax help

Ken Bloom vox-tech@lists.lugod.org
Wed, 28 Apr 2004 22:39:26 -0700


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

On Wed, Apr 28, 2004 at 10:33:13PM -0700, Larry Ozeran wrote:
> Thanks for the great discussion. I really appreciate everyone's ideas. Un=
fortunately, it appears that find is using similar expansion of the * leadi=
ng to the same error.
>=20
> [root@localhost mailman]# find -iname \erro*.[1-4].[1-4] -print0 | xargs =
-r0 rm -f
> bash: /usr/bin/find: Argument list too long
>=20
> [root@localhost mailman]# find -iname \erro*.[1-4] -print0 | xargs -r0 rm=
 -f
> bash: /usr/bin/find: Argument list too long

You *need* to put the pattern in quotes, because otherwise the shell
will perform wildcard expansion just the same way it was doing for the
rm command. Try=20
find -iname 'erro*.[1-4].[1-4]' -print0 | xargs -r0 rm -f
This should stop the nasty expansion.

This was demonstrated implicitly before, as Foo Lim said:
> >
> >Try using xargs like this:
> >
> >find . -name "error*" | xargs rm
> >
> >You can also try doing it through the find command like this:
> >
> >find . -name "error*" -exec rm \{} \;

--=20
I usually have a GPG digital signature included as an attachment.
See http://www.gnupg.org/ for info about these digital signatures.
My key was last signed 10/14/2003. If you use GPG *please* see me about=20
signing the key. ***** My computer can't give you viruses by email. ***

--8t9RHnE3ZwKMSgU+
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: Digital signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQFAkJUOlHapveKyytERAlp9AKCjezddTAWH0y9Ips0EGSo597t2twCaApFS
u2frUtwdexqyfvAdzYYQgho=
=ct7r
-----END PGP SIGNATURE-----

--8t9RHnE3ZwKMSgU+--