Script is hanging

Hello,

I have the following shell script and when i execute, it keeps hanging and nothing happens

Please let me know.

Requirement is to read data from file and pass it to the sql and create files as shown.

code

/********
#!/bin/sh
while read user.dat
do
echo "user = $1 email = $2"
done

sqlplus -S /NOLOG << EOF
connect username/pwd@schema
select user_name,count(*) from apps.fnd_user
where 1=1 and user_name ('$1') and email_address ('$2')
group by user_name;
EOF
if $? -ne 0
then
% cat > user_exist
else
% cat > user_notexist
fi 
exit 0
*******/

Data File
rsreenivasa null

The "cat" command is awaiting standard in to feed to the output file.

Probably, you want to cat "some file" to the appropriate output file.

I have this problem all the time when I type a grep command, and forget to put the file to grep.