[CentOS] Bash Script for Beginners! oh dear :'(

William L. Maltby CentOS4Bill at triad.rr.com
Wed Dec 24 12:40:42 UTC 2008


On Wed, 2008-12-24 at 01:34 +0100, Matej Cepl wrote:
> On 2008-12-23, 12:15 GMT, James Bensley wrote:
> > find . -exec grep -q "$1" '{}' \; -print >> ./found_files
> 
> I think you can have only one action (either -exec or -print), 
> but not sure about it. Anyway, my first instinct when things are 

Ought to work. That's the purpose of the '\;' IIRC. Here's a similar
test.

$ \
> find .mozilla -name 'plugin*' -exec ls -ld {} \; -print
-rw------- 1 wild-bill hardtolove 1817 Feb 29
2008 .mozilla/pluginreg.dat-
.mozilla/pluginreg.dat-
drwxr-xr-x 2 wild-bill wild-bill 4096 Apr  2  2008 .mozilla/plugins
.mozilla/plugins
-rw------- 1 wild-bill hardtolove 7662 Jun 14
2008 .mozilla/firefox/pluginreg.dat-
.mozilla/firefox/pluginreg.dat-
-rw------- 1 wild-bill wild-bill 5225 Nov 27
07:18 .mozilla/firefox/iqa6tz9r.default/pluginreg.dat-
.mozilla/firefox/iqa6tz9r.default/pluginreg.dat-
-rw------- 1 wild-bill wild-bill 5817 Dec  7
08:45 .mozilla/firefox/iqa6tz9r.default/pluginreg.dat-2
.mozilla/firefox/iqa6tz9r.default/pluginreg.dat-2
-rw------- 1 wild-bill wild-bill 5817 Dec  7
08:45 .mozilla/firefox/iqa6tz9r.default/pluginreg.dat
.mozilla/firefox/iqa6tz9r.default/pluginreg.dat
> getting to be more complicated is to use while cycle, like this:
> <snip>

-- 
Bill



More information about the CentOS mailing list