Try this ( if u are using shell script )

set `date`

ORACLE_SID=orcl
export ORACLE_SID
sqlplus system/xxxx < spool temp1$2.$3log
select sysdate from dual ;
spool off
!

echo "\nJob Over"