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

2008-12-26 Thread Matej Cepl
On 2008-12-24, 01:22 GMT, MHR wrote: > On Tue, Dec 23, 2008 at 4:34 PM, 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. An

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

2008-12-24 Thread William L. Maltby
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 ar

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

2008-12-23 Thread MHR
On Tue, Dec 23, 2008 at 4:34 PM, 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 > g

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

2008-12-23 Thread Matej Cepl
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 th

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

2008-12-23 Thread James Bensley
Thanks all for your prompt replies. I have picked the best bits of what I received and make my own script from that. Thanks a lot guys, a good lesson in shell scripting today! Greatly appreciated ;) Regards, James. -BEGIN GEEK CODE BLOCK- Version: 3.1 GIT/MU/U dpu s: a--> C++>$ U+> L

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

2008-12-23 Thread Alexander Dalloz
James Bensley schrieb: > For those interested here is an updated version of my script but still > no luck :( > > #!/bin/bash > rm -f ./found_files > touch ./found_files > find . -exec grep -q "$1" '{}' \; -print >> ./found_files > i=1 > while [ $i -le `wc -l found_files` ] ; do > line=`head -$

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

2008-12-23 Thread John Doe
> Scenario: > /some/directory/where/blacklist/is/stored contains about 40-50 folders > called, adult, gambling, banking, warez etc. There is a folder for > each blocking category (and in each folder is two files, urls and > domains, standard stuff for web filtering!) > > I have a script to search

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

2008-12-23 Thread James Bensley
For those interested here is an updated version of my script but still no luck :( #!/bin/bash rm -f ./found_files touch ./found_files find . -exec grep -q "$1" '{}' \; -print >> ./found_files i=1 while [ $i -le `wc -l found_files` ] ; do line=`head -$i found_files | tail -1` grep -iv "$1"

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

2008-12-23 Thread James Bensley
Hey guys, I'm a bit of a beginner (understatement!) with shell scripting and seek help! I am setting up our new squid proxy. Its working a treat and squidGuard is the icing on the cake. But, I am trying to write a shell script to search through our black list category's for squidGuard and remove t