use of EOF in scripting [message #266675] |
Tue, 11 September 2007 06:54 |
saharookiedba
Messages: 56 Registered: September 2007 Location: PUNE
|
Member |
|
|
Hi
please tell me the reason why we use EOF , when we write sqlplus commands in UNIX Shell Scripting.
sample code:
#!/bin/ksh
#Author : sahadevan
#Assignment 1
#version 1.2
clear
if [ $# -ne 2 ]; then
echo "Invalid Usage: "
echo "Usage assign.sh <spool file name> <oratab file>"
exit 1
fi
if [ -r $2 ]; then
#spoolFile=/usr/users/saha/test/spool1.txt
spoolFile=$1
for sids in `cat /var/opt/oracle/oratab | grep -v \# | grep -v \* |cut -d":" -f 1`
do
export ORACLE_SID=$sids
export ORAENV_ASK=NO
.oraenv
sqlplus "/as sysdba" << EOF
spool $spoolFile
select instance_name from v\$instance;
exit
EOF
done
else
echo "Oratab file given does not exist"
exit 1
fi
|
|
|
|
|