#!/bin/sh
#

#----------------------------
# Loop over all FEBs:
#----------------------------
FE_Id=436

while [ ${FE_Id} -le 436 ] ; do

# Last Test ID:
    export fe_path=/www/pub/experiments/bfys/lhcb/outerTracker/Electronics/Production/FE-Plots/FE_${FE_Id}/
    Test_Id=`ls ${fe_path} | sed -n 's/^'"test"'\([0-9][0-9]*\)/\1/p' | sort -n | tail -1`
    export test_path=/www/pub/experiments/bfys/lhcb/outerTracker/Electronics/Production/FE-Plots/FE_${FE_Id}/test${Test_Id}/    
    
    test -d ${test_path}

    dir_exist=`echo $?`
    if [ ${dir_exist} -eq 0 ] ; then

	echo 'Create html file for ' ${FE_Id} ${Test_Id}
	echo '-----------------------------------------'
	mkbrows.sh ${FE_Id} ${Test_Id}
	#ls -ltr ${fe_path}/*html

    else
	echo 'Directory does not exist: FE' ${FE_Id} ${Test_Id}
	echo '------------------------------------------------'
    fi    
    FE_Id=`expr ${FE_Id} + 1`
done

