:


if(test $# -lt 2) then
  echo " This command needs at least two parameters,
           which indicates the numbers of models"
  exit 1
fi


if(test -d results_) then 
   rm results_/*.red
else 
   mkdir results_
fi

if(test ! -r sub.red) then 
    echo "end;" > sub.red
fi

modeln=$1
mdl11=""
while(test $modeln  -ne 1  )
do
  modeln=`expr $modeln  - 1` 
  mdl1=$mdl1"["
done

modeln=$2
mdl2=""
while(test $modeln  -ne 1  )
do
  modeln=`expr $modeln  - 1`  
  mdl2=$mdl2"["
done


#read Process #It is expected to read a process  string like "e,E->m,M"

read Process


while( test  "$Process" )
do



#  echo =========================
#  echo $Process
  

  rm  -f results/*.red  results_/*.red  tmp/*    # to start from the beginning

  com1=$mdl1{{$Process{{[{[{[[[{0 
  bin/s_calchep -blind "$com1"   1>/dev/null 2>/dev/null  
  if(test $? -ne 0) then 
        echo $Process  ERROR: absent in model $1
        read Process
        continue       
  fi 
  mv results/symb1.red  results_/

  rm tmp/safe
  com2=$mdl2{{$Process{{[{[{[[[{0  
  bin/s_calchep -blind  "$com2"  1>/dev/null 2>/dev/null
  if(test $? -ne 0) then 
        echo $Process  ERROR: absent in model $2
        read Process
        continue       
  fi 


#  YOUR CHECK BEGIN
#



  diff  results/symb1.red results_/symb1.red > diff
  if(test -s diff) then 

     if(test -f message) then 
        rm message
     fi 

     cat  cmp.red |  reduce >r-session 
     rm r-session
     if(test -s message) then
        R=`cat message | tail -n 1`
        echo  $Process  $R  
     else 
        echo  REDUCE can not perform summation for  $Process  ERROR 
     fi
  else
     echo  $Process  oK
  fi
#
# YOUR CHECK END

  read Process
done

#rm   message
