Simple Shell Script using function

Hi all,
I am new to shell scripting.I have made a simple shell script which will give me number of records in a database table. The SQL statement is working fine and there are 11 rows in this table. But problem is that it is not printing this value and fucntion does not get called. Please see the debug output at the end. The variable count2 does not get initialzed. Thanks.

#!/usr/bin/ksh
set -x
UIDPWD=`cat $TABS_HOME/.restrict/$ORACLE_SID`
export UIDPWD

get_number1()
{
   set -x
   sqlplus -s <<!
   $UIDPWD
   set head off
   set feedback off
   select count(*)
   from MSC041501_090318A
   /
   exit
   !
}
count2 = `get_number1`
echo "The total number of records in file is $count2"

Debug Output:

+ + cat /export/home/tabs/.restrict/TABST1
UIDPWD=its/its123
+ export UIDPWD
+ get_number1
+ sqlplus -s
+ 0<<
its/its123
set head off
set feedback off
select count(*)
from MSC041501_090318A
/
exit
+ count2 = 11
./count.sql[17]: count2:  not found
+ echo The total number of records in file is
The total number of records in file is

I edited your post, use CODE tags in future please, ty.

problem:

count2 = `get_number1`

solution:

count2=`get_number1`

No blanks between var name, = and the value when defining variables in the shell.

thanks a lot...it is working now...

The issue is solved but it is giving an extra line in the output even using the below statement:

count2=`get_number1 | awk '{print $1}'`

count2=
11
+ echo The total number of records in file is
11
The total number of records in file is
11

I want the result like this:

The total number of records in file is 11

Try

count2=`get_number1 | tr -d '\n'`

thanks...its wokring fine now...

The total number of records in file is 11