Help with setting a variable!

I am working within a while loop and i am trying to set a variable that will read out each count of the files. the problem is the count variable i have set up gives me a total and not the individual count of each file. in the data area there is 4 abc.dat and 1 def.dat.

how can i do this???

see below:

while read FILE
do
STATUS="OK"

COUNT=`ls ../data/abc.dat* ../data/def.dat* | wc -l`

if [ $abc.dat -lt 4 ]
then
STATUS="WARNING"
fi

  if [ $def.dat -lt 2 ]
     then
     STATUS="WARNING"
  fi

done < $FILE_LIST

I see where you try to set COUNT . (I don't think it will do what you think it will in this manner.) However you then do an if on $abc.dat and another on $def.dat -- but I do not see where these are set. Perhaps this is your issue since an undefined variable will be less than 4 when doing an "if" condition.

I think you want something more like
COUNTabc=$(cat ../data/abc.dat* | wc -l)
COUNTdef=$(cat ../data/def.dat* | wc -l)
[Each of the above will set a variable with the count for number of lines.]

and then do your "if" conditions with $COUNTabc and $COUNTdef

Sorry joeyg, should be more clear,

the files come in as the following abc20080101.dat, abc20070207.dat etc. They are all different. I want to be able to count up all files that start with abc*****.dat and the same for def*****.dat. when it has worked out the total for each it confirms the number into the output below. so we know how many files there are of each.

I output this script to a table (so the if statement says if they don't match number of files that should be in echo warning) in an email see below:
x.sh:+----------------------------------------------------------------------------------------------------------------------------------+
x.sh:|FILE |NUMBER OF FILES |STATUS |
x.sh:+----------------------------------------------------------------------------------------------------------------------------------+
x.sh:|/imp/cdmspb/Live_Jobs/XXXX/data/abc***** | 5 |OK |
x.sh:|/imp/cdmspb/Live_Jobs/XXXX/data/[def***** | 5 | |
x.sh:+-----------------------------------------------------------------------------------------------------------------------------------+