Error when calling sybase stored proc from shell script

Hi,
I am writing a script that needs to call a stored proc which would update a column in a table based on a condition.
I need to also capture the number of rows updated.
However, When I execute the script I keep getting this error:
./test_isql.sh: syntax error at line 33: `end of file' unexpected

I have listed my stored proc and shell script below. Please help. I have been stuck a couple of days on this!!

If I remove the part with the isql, the script works fine!!

This is my stored proc:

 
IF OBJECT_ID ('dbo.UpdateForecastRunning_pr') IS NOT NULL
 DROP PROCEDURE dbo.UpdateForecastRunning_pr
GO
/*
* $Header:$
* 
*/
/*$Log:$
 * 
*/
CREATE PROC UpdateForecastRunning_pr
        
AS
  
BEGIN
    UPDATE System SET VersionNbr = '2.19.6'
    WHERE VersionNbr = '2.19.5'
  
    RETURN @@ROWCOUNT
END

GO

And this is my shell script:

 
#!/bin/sh
. /global/Shrc
# Usage
if [ $# -ne 3 ]
then
echo "Usage test_isql.sh Username Password Server"
exit 1
fi
echo $1
echo $2
echo $3
USER=$1
PASSWORD=$2
SERVER=$3
#isql -U $USER -S DEVEL -P monkeypod -i updatesystem.sql -o system.DEVEL
trycount="0"
ROWSUPDATED=0
echo "Before While begins"
while [ "$ROWSUPDATED" -lt 1 ] && [ "$trycount" -lt 10 ]
do
echo "Starting while loop"
ROWSUPDATED=isql -D$icasb  -U $USER -S DEVEL -P monkeypod -o system.DEVEL << EOF
EXEC icasb..UpdateForecastRunning_pr
EOF
trycount=`expr $trycount + 1`
echo "Procedure returned: $trycount"
done
exit 0

Thank You
Karthik

ROWSUPDATED=isql -D$icasb  -U $USER -S DEVEL -P monkeypod -o system.DEVEL << EOF
EXEC icasb..UpdateForecastRunning_pr
EOF

this is causing syntax error.

if you really want to capture the db o/p into the variable, use `` or $()

ROWSUPDATED=`isql -D$icasb  -U $USER -S DEVEL -P monkeypod -o system.DEVEL << EOF
EXEC icasb..UpdateForecastRunning_pr
EOF`

Hi,
Thanks for the reply. That took care of the error, but still the RowsUpdated value is not getting updated. Its showing up as a null string when I echo it out:

 
echo "Rows Updated: $ROWSUPDATED"

The output is

 
Rows updated:<blank>

what is the output of the proc when you execute it on the sybase prompt?
if possible, post the output.