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

Larry Ozeran vox-tech@lists.lugod.org
Wed, 28 Apr 2004 23:57:13 -0700


Thanks Ken.

I had not seen quotes working from the first find suggestion:
Consider another direction:
$ find /var/log -iname \*.[0-9].[0-9] -print0 | xargs -r0 rm -f

The quotes are indeed necessary. It worked!

Thanks again to everyone who contributed.

- Larry

*********** REPLY SEPARATOR  ***********

On 4/28/04 at 10:39 PM Ken Bloom wrote:

>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 
>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 \{} \;
>
>-- 
>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 
>signing the key. ***** My computer can't give you viruses by email. ***
>
>-----BEGIN PGP SIGNATURE-----
>Version: GnuPG v1.2.4 (GNU/Linux)
>
>iD8DBQFAkJUOlHapveKyytERAlp9AKCjezddTAWH0y9Ips0EGSo597t2twCaApFS
>u2frUtwdexqyfvAdzYYQgho=
>=ct7r
>-----END PGP SIGNATURE-----
>
>_______________________________________________
>vox-tech mailing list
>vox-tech@lists.lugod.org
>http://lists.lugod.org/mailman/listinfo/vox-tech


- Larry