[CentOS] Bash Script for Beginners! oh dear :'(
Matej Cepl
mcepl at redhat.comWed Dec 24 00:34:22 UTC 2008
- Previous message: [CentOS] Bash Script for Beginners! oh dear :'(
- Next message: [CentOS] Bash Script for Beginners! oh dear :'(
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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 getting to be more complicated is to use while cycle, like this: find . |while read FILE ; do if grep "$FILE" '{}' >/dev/null 2>&1 ; then echo "$FILE" >> ./found_files fi done Matěj
- Previous message: [CentOS] Bash Script for Beginners! oh dear :'(
- Next message: [CentOS] Bash Script for Beginners! oh dear :'(
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the CentOS mailing list