At 04:11 PM 8/30/2001, Steve Wright wrote:
>I have just developed a simple site search.. .and am after learning how to
>get it to search all directories... at present, it only searches the one it
>is in!!


>             $cmdstr = "grep -i $searchstr *";

"man grep" on my linux box shows:

        -r, --recursive
               Read all files under each directory, recursively; this is 
equivalent to the -d recurse

change it to:

$cmdstr = "grep -r -i $searchstr *";

In all honesty though, you might want to use an ereg_replace() on 
$searchstr before doing that, so that special shell characters can't get 

Interesting take on searching...


[EMAIL PROTECTED]       -              0xF50BB9D7
A21A FD82 8C30 EC77 CCCC  545D A0B3 F501 F50B B9D7
ICQ: 14295546            -            AIM: kw34hd1

PHP General Mailing List (
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to