Hello ,
This is the piece of the code which is giving me trouble
if [ ! -r "${SOURCEDIR}/${OUT_FILE}" ] ;then
exit_proc "${SOURCEDIR}/${OUT_FILE} does not exists or not readable" 2
else
word_count=`wc -l < ${SOURCEDIR}/$OUT_FILE`
fi
if [ "${word_count}" -ge "$FILE_COUNT" ] ;then
exit_proc "Word_count is more than allowed limit" 1
else
exit_proc "Word_count is less than allowed limit " 0
fi
When i execute it I get an error like the one give below
smkt_impl_fl_check.sh: line 30: [: : integer expression expected
Can someone please assist
Sorry
The If condition is Line 30
And how is FILE_COUNT
set?
This code is being called by another scipt, on that script the file count is defined as
word_length=`head -1 /infadata/Temp/file_limit`
it is passed to this program as a command line argument
Code is
/home/sri/smkt_impl_fl_check.sh $word_length
in the calling program
and
FILE_COUNT=$1
in this program
try printing the FILE_COUNT and see what's the output.
Include the below line at the top of your code and provide us the output
echo "${FILE_COUNT}"
hi
the Echo was not returning any output, so instead of calling it from the caller script and passing it as a Command Line argument, I derived the File count value in this script.and it worked :)
Thank you everyone for your assistance