#!/bin/sh if test $# -lt 2 then echo "usage: `basename $0` [...]" \ " [<--> [...]]" 1>&2 exit 1 fi str="$1" && shift i=0 while test "x$1" != "x" do test "x$1" == "x--" && { shift; break; } test -d "$1" || { echo "`basename $0`: $1: no such directory" 1>&2 exit 1 } d=dir${i} eval $d=\"\$1\" && shift i=`expr $i + 1` done j=0 while test $j -lt $i do d=`eval echo \$\{dir$j\}` case $d in -*) d="./$d";; esac find "$d" -type f -print0 | xargs -0 grep "$@" -- "$str" j=`expr $j + 1` done exit 0