#!/bin/bash 
printf "Content-type: text/html\n\n<HTML><BODY><PRE>\n"
if [[ -n $QUERY_STRING ]] 
then
 text=`echo $QUERY_STRING |sed 's/.*=//'`
 if [[ -z $text ]]
 then
  echo "search string missing"
  exit 1
 else
  date >>mfind.cgi.out
  echo "searching for \"$text\"" |tee -a mfind.cgi.out
 fi
 nohup /bin/find /home/solenodo/mail \( -type f -exec grep -iq "$text" {} \; \) -exec ls -ld {} \; |sed 's/$/<BR>/'  |tee -a mfind.cgi.out  &
else
 echo "<I>text \"$text\" not found</I><BR>"
fi
printf "</BODY></HTML>\n"
