syntax error: unexpected end of file

Hi,

I need ur help is this matter, i have th ebelow script, and i keep getting this error: syntax error: unexpected end of file

affectedRow=`cat dbOutput.log | grep "1 row affected"`
echo "affectedRow : $affectedRow"

if [ "$affectedRow" == "" ]; then
echo "Look to the next OMCDB"
$SYBASE/$SYBASE_OCS/bin/isql -P password -S UXESPOMC02 -o dbOutput.log <<EOF
select sub_number, pool_number, VMU_number from mmsdb..subscr_standard where sub_number = "$MSISDN"
go
exit
else
echo "Is not Empty"
fi

The output error is: ./SMBGenerator.sh: line 30: syntax error: unexpected end of file

Can any body help me with, appreciate it.

  • Alaeddin

You haven't close the limit string of the here document:

command <<EOF
.
.
.
EOF

Regards

Hi,

May you tell me where exactly to put it, cause i tried it in many palces, and still the same :S !!

regards

Should be on the line after fi without a leading space. Does it work properly if you type the commands on the command line?
Have you save the script with a windows editor?

Regards

Hi,

i tried as u told me:

affectedRow=`cat dbOutput.log | grep "1 row affected"`
echo "affectedRow : $affectedRow"

if [ "$affectedRow" == "" ]; then
echo "Look to the next OMCDB"
$SYBASE/$SYBASE_OCS/bin/isql -P tecnote7 -S UXESPOMC02 -o dbOutput.log << EOF
select sub_number, pool_number, VMU_number from mmsdb..subscr_standard where sub_number = "$MSISDN"
go
quit
else
echo "Is not Empty"
fi
EOF

which lead to the same, and i tried teh commands seperatly and was working, but once compined them togather, something happen.

Well I'm using the Unix SSH console directly.

Regards

Hope you understand now.

affectedRow=`cat dbOutput.log | grep "1 row affected"`
echo "affectedRow : $affectedRow"

if [ "$affectedRow" == "" ]; then
     echo "Look to the next OMCDB"
     $SYBASE/$SYBASE_OCS/bin/isql -P tecnote7 -S UXESPOMC02 -o dbOutput.log << EOF
         select sub_number, pool_number, VMU_number from mmsdb..subscr_standard where sub_number = "$MSISDN"
         go
         quit
         EOF
else
     echo "Is not Empty"
fi

Hi,

Already tried that before dude, man i tried to put EOF every where and still the same:

affectedRow=`cat dbOutput.log | grep "1 row affected"`
echo "affectedRow : $affectedRow"

if [ "$affectedRow" == "" ]; then
echo "Look to the next OMCDB"
$SYBASE/$SYBASE_OCS/bin/isql -P tecnote7 -S UXESPOMC02 -o dbOutput.log << EOF
select sub_number, pool_number, VMU_number from mmsdb..subscr_standard where sub_number = "$MSISDN"
go
quit
EOF
else
echo "Is not Empty"
fi

./SMBGenerator.sh: line 32: syntax error: unexpected end of file

Check the line 32, maybe you have another EOF missing.

Hi Guys,

Any Help !!!

Regards

Hi,

Well it dosen't

Regards

Hi.

One of isql man pages says it requires an empty line before the end.

So you would need something like:

...
if [ "$affectedRow" == "" ]; then
echo "Look to the next OMCDB"
$SYBASE/$SYBASE_OCS/bin/isql -P password -S UXESPOMC02 -o dbOutput.log <<EOF
select sub_number, pool_number, VMU_number from mmsdb..subscr_standard where sub_number = "$MSISDN"
go
quit

EOF
else
echo "Is not Empty"
fi

Best wishes ... cheers, drl