shell script provides an error that a binary operator is required
Please help me with the following Shell script
the scripts seems to ask for a binary operator ..
# mgrep -- search for a file for 3 words in a line
# usage -- mgrep FILENAME word1 word2 word3.
file=$1
if test grep $2 $file
then
if test grep $2 $file | grep $3
then
if test grep $2 $file | grep $3 | grep $4
then
grep $2 $file | grep $3 | grep $4
else
echo $4 not found.
fi
else
echo $3 not found.
fi
else
echo $2 not found.
fi
~
|