Is it correct? if test grep EOF $a ...

read a
if test grep EOF $a
then echo yes file
else 
echo no
fi

Welcome to the forum.

No, it is not. Running above through a shell immediately yields

bash: test: EOF: binary operator expected

Try

if grep EOF $a

and make sure to enter the name of an existing file when read ing a .