sqlplus is waiting for your input - I'd imagine your command is just hanging. Look at the tnsping utility. (You should have it if you have sqlplus). It should do what you want. Also, there's no reason to redirect output here. System will store the return code, that's all you need.
tnsping tests only Oracle listener not database. one can create temporary file:
set head off
connect scott/tiger@mydb
select 'mydb is available' from dual;
exit
run it with
sqlplus -s /nolog @test.sql
and analyze sqlplus output.
but the best solution of course dbi