How to execute a simple select script using a shell script?

Hi team,

I have two select statements and need to run them using SYSDBA user

select * from temp_temp_seg_usage;

select segment_name, tablespace_name, bytes/ (1024*1024) UsedMb from 
dba_segments where segment_name='TEMP_TEMP_SEG_USAGE';

Need to run this using a shell script say named select.txt

Can some one help me with the code, i am really new to shell scripting.

Regards,
Pramod

Normally, it would go something like this:

sqlplus -s / as sysdba << !
set pagesize off heading off feedback off
<your select statements go here>
!

To run the "script":

sqlplus -s / as sysdba @select.txt

Make sure "select.txt" exits the script.

If you need to set your Oracle environment beforehand, run this before the sqlplus:

ORAENV_ASK=NO
ORACLE_SID=<your Oracle SID here>
. oraenv