Display Error [: : integer expression expected

i have lunix 5.4
i make script to tack the export from database 11g by oracle user
the oracle sheel is /bin/bash
when run this script display this error

./daily_xport_prod: line 36: [: : integer expression expected

the daily_xport_prod script

#! /bin/sh
#
ORACLE_HOME=/u01/appl/oracle/product/11.2.0/db_1
export ORACLE_HOME
ORACLE_SID=TESTDB
export ORACLE_SID
PATH=$ORACLE_HOME/bin:/bin:/usr/bin:/etc
export PATH
LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${ORACLE_HOME}/lib
export LD_LIBRARY_PATH
expdir="/backup/testdb/exports"
mailm="nienhaus@gdls.com,bradyj@gdls.com"
partition="/backup/testdb"
xsize="100000"
#
#This portion checks the write access to the directory
#
if [ -w "$expdir" ]
then
# This portion is used to get the value of the day in the variable day.
# the export file is named as expdatMon.dmp etc.
#
#ifile is the name of the file the oracle db is exported to.
#
day=`date +%a`
ifile=$expdir"/full_prod_"$day.exp
# Give write access to export file
#chmod 600 $ifile
#
#This portion gets the value of free space in the disk, the value is
# checked and if it is greater than $xsize then the export is performed
# or else a message is sent to the appropriate user_id.
#
#remspace is the variable that contains the free space in home2
remspace=`df -k | awk '$NF == p{print $4}' p=$partition`
if [ "$remspace" -lt "$xsize" ]
then
mailx -s "Oracle export of PROD database on ETP0" $mailm <<!
The "prod" database export failed because the space in the $partition
partition was not enough. "prod" database Export not performed.
!
#chmod 400 $ifile
exit 1
else
gzip < /home/oracle/backup/exp_prod > $ifile.gz &
/u01/appl/oracle/product/11.2.0/db_1/bin/exp parfile=pfile.prod full=Y log=daily_xport_prod.log compress=N statistics=none file=/home/oracle/backup/exp_prod buffer=65536 consistent=y 1> /dev/null 2>&1
if [ $? -ne 0 ]
then
mailx -s "Oracle export of PROD database on ETP0" $mailm <<!
Something went wrong with the "prod" database export.
!
#chmod 400 $ifile
exit 1
else
mailx -s "Oracle export of PROD database on ETP0" $mailm <<!
"prod" database Export finished successfully.
!
tail -1 daily_xport_prod.log | mailx -s "tail of PROD database export log on ETP0" $mailm
exit 0
fi
fi
else
mailx -s "Oracle export of PROD database on ETP0" $mailm <<!
No write permission to directory $expdir. "prod" database Export not performed.
!
exit 1
fi
i have lunix 5.4 
i make script to tack the export from database 11g by oracle user 
the oracle sheel is /bin/bash 
when run this script display this error 
./daily_xport_prod: line 36: [: : integer expression expected 
 
the daily_xport_prod script 
 
#! /bin/sh
#
ORACLE_HOME=/u01/appl/oracle/product/11.2.0/db_1
export ORACLE_HOME
ORACLE_SID=TESTDB
export ORACLE_SID
PATH=$ORACLE_HOME/bin:/bin:/usr/bin:/etc
export PATH
LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${ORACLE_HOME}/lib
export LD_LIBRARY_PATH
expdir="/backup/testdb/exports"
mailm="nienhaus@gdls.com,bradyj@gdls.com"
partition="/backup/testdb"
xsize="100000"
#
#This portion checks the write access to the directory 
# 
if [ -w "$expdir" ] 
then 
# This portion is used to get the value of the day in the variable day.
# the export file is named as expdatMon.dmp etc.
# 
#ifile is the name of the file the oracle db is exported to. 
# 
day=`date +%a`
ifile=$expdir"/full_prod_"$day.exp
# Give write access to export file
#chmod 600 $ifile 
#
#This portion gets the value of free space in the disk, the value is 
# checked and if it is greater than $xsize then the export is performed
# or else a message is sent to the appropriate user_id.
#
#remspace is the variable that contains the free space in home2 
remspace=`df -k | awk '$NF == p{print $4}' p=$partition`
if [ "$remspace" -lt "$xsize" ] 
then
mailx -s "Oracle export of PROD database on ETP0" $mailm <<!
The "prod" database export failed because the space in the $partition 
partition was not enough. "prod" database Export not performed.
!
#chmod 400 $ifile 
exit 1
else
gzip < /home/oracle/backup/exp_prod > $ifile.gz &
/u01/appl/oracle/product/11.2.0/db_1/bin/exp parfile=pfile.prod full=Y log=daily_xport_prod.log compress=N statistics=none file=/home/oracle/backup/exp_prod buffer=65536 consistent=y 1> /dev/null 2>&1
if [ $? -ne 0 ]
then
mailx -s "Oracle export of PROD database on ETP0" $mailm <<!
Something went wrong with the "prod" database export.
!
#chmod 400 $ifile 
exit 1
else
mailx -s "Oracle export of PROD database on ETP0" $mailm <<!
"prod" database Export finished successfully.
!
tail -1 daily_xport_prod.log | mailx -s "tail of PROD database export log on ETP0" $mailm
exit 0
fi
fi
else
mailx -s "Oracle export of PROD database on ETP0" $mailm <<!
No write permission to directory $expdir. "prod" database Export not performed.
!
exit 1
fi

[/quote]

please post the code again using code tags. ( select the code and press "#" from the toolbar.)
meanwhile, check whether $remspace is calculating properly. and $xsize has the proper value. and make sure that both are integers.

#! /bin/sh
#
ORACLE_HOME=/u01/appl/oracle/product/11.2.0/db_1
export ORACLE_HOME
ORACLE_SID=TESTDB
export ORACLE_SID
PATH=$ORACLE_HOME/bin:/bin:/usr/bin:/etc
export PATH
LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${ORACLE_HOME}/lib
export LD_LIBRARY_PATH
expdir="/backup/testdb/exports"
mailm="nienhaus@gdls.com,bradyj@gdls.com"
partition="/backup/testdb"
xsize="100000"
#
#This portion checks the write access to the directory 
# 
if [ -w "$expdir" ] 
then 
# This portion is used to get the value of the day in the variable day.
# the export file is named as expdatMon.dmp etc.
# 
#ifile is the name of the file the oracle db is exported to. 
# 
day=`date +%a`
ifile=$expdir"/full_prod_"$day.exp
# Give write access to export file
#chmod 600 $ifile 
#
#This portion gets the value of free space in the disk, the value is 
# checked and if it is greater than $xsize then the export is performed
# or else a message is sent to the appropriate user_id.
#
#remspace is the variable that contains the free space in home2 
remspace=`df -k | awk '$NF == p{print $4}' p=$partition`
if [ "$remspace" -lt "$xsize" ] 
then
mailx -s "Oracle export of PROD database on ETP0" $mailm <<!
The "prod" database export failed because the space in the $partition 
partition was not enough. "prod" database Export not performed.
!
#chmod 400 $ifile 
exit 1
else
gzip < /home/oracle/backup/exp_prod > $ifile.gz &
/u01/appl/oracle/product/11.2.0/db_1/bin/exp parfile=pfile.prod full=Y log=daily_xport_prod.log compress=N statistics=none file=/home/oracle/backup/exp_prod buffer=65536 consistent=y 1> /dev/null 2>&1
if [ $? -ne 0 ]
then
mailx -s "Oracle export of PROD database on ETP0" $mailm <<!
Something went wrong with the "prod" database export.
!
#chmod 400 $ifile 
exit 1
else
mailx -s "Oracle export of PROD database on ETP0" $mailm <<!
"prod" database Export finished successfully.
!
tail -1 daily_xport_prod.log | mailx -s "tail of PROD database export log on ETP0" $mailm
exit 0
fi
fi
else
mailx -s "Oracle export of PROD database on ETP0" $mailm <<!
No write permission to directory $expdir. "prod" database Export not performed.
!
exit 1
fi

---------- Post updated at 03:05 AM ---------- Previous update was at 02:42 AM ----------

Please send me the correct code for this line

what I was trying to say is please check whether the $remspace and $xsize contains some integer value.

what is the value of these variables? try putting echo and debug.

What is the output from these commands:

df -k

df -k "/backup/testdb"

what i do

Run the script in debug mode and check the values of the variables remspace and xsize.

Add the line:

set -x

below the line (shebang):

#!/bin/ksh

I think that the line which fails is this one:

Because this line is going wrong.

remspace=`df -k | awk '$NF == p{print $4}' p=$partition`

In order to understand what happened we need to know what the output of "df -k" looks like on your system.