Operating System - HP-UX
1820693 Members
2878 Online
109627 Solutions
New Discussion юеВ

syntax error: unexpected end of file

 
siddharthC
Occasional Advisor

syntax error: unexpected end of file

Hi,

I am getting error "syntax error: unexpected end of file" when i am running the below script. I don't found any syntax errors. Pls. help

----------

while [ 1 = 1 ]
do
trap " " 1 2 3 5 15
echo "Do You Want To Start The Production Hot backup (Y/N) "
read yn
if test $yn = 'Y' || test $yn = 'y'
then
cd /data/vision/scripts
#rm nohup.out
read v_pass
clear
v_tbs_chk=`sqlplus -silent system/$v_pass < set pagesize 0 feedback off verify off heading off echo off
select tablespace_name||' - '||file_name from dba_data_files df,v\\$backup bkp where df.file_id=bkp.FILE# and bkp.status='ACTIVE';
exit;
END`
#Check whether variable contains any string. -z is to check if the string length is zero
if test -z "$v_tbs_chk"
then
echo "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
echo "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
banner "DB BACKUP" STARTED
echo "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
echo "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
#backup.sh $v_pass 2>&1|tee -a nohup.out
exit
else
echo "Mail"
echo $v_tbs_chk > tbs_in_bkp_mode.log
SUBJ="Tablespace in backup mode"
TO=abc.xyz@pqr.com
(
cat << !
To : ${TO}
Subject : ${SUBJ}
!
cat << !
There are some tablespace or datafiles in backup mode
Please check the enclosed file for details.
!
uuencode tbs_in_bkp_mode.log tbs_in_bkp_mode.log
) | sendmail -v ${TO}
exit
fi
else
if test $yn = 'N' || test $yn = 'n'
then
echo "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
echo "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
banner "DB BACKUP" "NOT DONE"
echo "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
echo "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
exit
fi
fi
done
-----------------

Thanks in advance
Siddharth
4 REPLIES 4
RAC_1
Honored Contributor

Re: syntax error: unexpected end of file

if and fi is not matching.
set -vx and run script to know, to know where it's not matching.
There is no substitute to HARDWORK
Peter Godron
Honored Contributor

Re: syntax error: unexpected end of file

Hi,
you seem to have a problem with if statements ;-)
http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=1057895

Please read:
http://forums1.itrc.hp.com/service/forums/helptips.do?#28

Your profiles shows 0 points for 20 answers !
siddharthC
Occasional Advisor

Re: syntax error: unexpected end of file

Hi,

Problem was with that part that was sending the mails. I have exluded that part and it is running fine now.

Thanks a lot for suggestions.
Siddharth
siddharthC
Occasional Advisor

Re: syntax error: unexpected end of file

Thank you very much for your suggestions.