bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Spaces in args, escapes, and command substitution


From: Eric Blake
Subject: Re: Spaces in args, escapes, and command substitution
Date: Sun, 29 Oct 2006 07:14:17 -0700
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.7) Gecko/20060909 Thunderbird/1.5.0.7 Mnenhy/0.7.4.666

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to bash@zacglen.com on 10/29/2006 5:56 AM:
>> This also works.
>>
>>  find . -exec grep -q PATTERN {} \; -exec vi {} \;
>>
> 
> No it doesn't because it issues a fresh instance of vi per file.

Then use the POSIX-specified:
find . -exec grep -q PATTERN {} \; -exec vi {} +

That will execute grep once per file, then aggregate the successful
matches into a single invocation of vi (assuming you don't exceed ARG_MAX
limits), properly accounting for spaces in filenames.

- --
Life is short - so eat dessert first!

Eric Blake             ebb9@byu.net
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.1 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFRLc584KuGfSFAYARAmR7AJ9Zs08Pkq0cnMT09TgAJ2u3bXqnPACfZR/B
3ovkgmMhjPShcMCrBFmDkT4=
=wvb8
-----END PGP SIGNATURE-----




reply via email to

[Prev in Thread] Current Thread [Next in Thread]