rsh and sql query

Hi ...
I am doing a switch user and then rsh and then running a sql query .
I am successfull in rsh and logging into the database , but my query doesnt run ..
Here's the command :

su - linus -c "rsh -l linus psmf ORACLE_SID=SMP;export ORACLE_SID;sqlplus uname/passwd@PSMF.world"<<EO_SQL>/in/tmp/sars-sql
select * from name;
EOF

Could you pls check what is wrong in the commands ..
thanks
sars

This might work:
su - linus -c "rsh -l linus psmf ORACLE_SID=SMP;export ORACLE_SID;sqlplus uname/passwd@PSMF.world > in/tmp/sars-sql << EOF_SQL
select * from name;
EOF_SQL"

Moshe