What's wrong with my script ....

Please see below mentioned my script ... it ran once without any issue .... then after it is not coming out .... please suggest what is wrong?

#!/bin/ksh
## if (( ${num_errors} > 0 ));
export ACULOG=/home/varshnes/input
export num_errors=10
**** Search for 'Start correcting roll up conflicts' ****
STRING=$(find $ACULOG -name "*" | xargs grep -i "Start" | grep -i "correcting" | wc -l)
echo $STRING
 if (( ${STRING} > 0 ));
 then
 echo -n "$num_errors "
 num_errors=`expr $num_errors - 1`
 fi
STRING=$(find $ACULOG -name "*" | xargs grep -i "End" | grep -i "correcting" | wc -l)
echo $STRING
 if (( ${STRING} > 0 ));
 then
 echo -n "$status "
 num_errors=`expr $num_errors - 1`
 fi
echo -n "$num_errors "
 if (( ${num_errors} > 0 ));
 then
 echo "SEND MAIL NOW"
 fi
exit 0

Can you post the errors that you face?
The script looks fine assuming your 5th line as an comment line.

5th line is not an acceptable comment line...needs to be preceded with a hash/#-sign.

There is not any error ... it is simply not doing anything ... not coming out either. it ran once and do not know what I did and it has stoped working ... please suggest ..thx

right, because it gets to the 5th line and it starts trying to use globbing...for no reason, and stalls.

Comment out the 5th line...and maybe even redirect the script itself to 2>&1, and you may get it to run.

That was corerct ...removed *'s and it works fine ... a quick question though ...
the line ...

STRING=$(find $ACULOG -name "*" | xargs grep -i "Start" | grep -i "correcting" | wc -l)

Can it by write in different style? I'm trying to grep complete line here.

Thanks!

I'm not sure what you mean by grep complete line...? Looks like you're just grabbing any line in any file in that directory that contains "Start", and then counting only those that also contain "correcting"...

I would suggest maybe the following if you're looking for a more compact approach:

typeset -i STRING=$(find $ACULOG -name "*" |xargs grep -i "Start" |grep -c "correcting" )

Otherwise, if you mean to return the entire line, then you'd want to just stop counting:

COMP_LINE=$(find $ACULOG -name "*" |xargs grep -i "Start" |grep -i "correcting" )

Thnaks Curleb.