#!/bin/bash
if [ -f run_ex.log ]
then
  rm run_ex.log
fi
ST_DIR=$PWD
export MKL_NUM_THREADS=1
ulimit -s unlimited
for dir in dmut1 dmut2 dmu_rr RR_TD_PGMIX Reaction_norm group_selection dmuSNP G-BLUP Threshold  catagorical glmm dominance  abs_qtl dmu_QTL Cure
do
  cd $dir
  echo " "
  echo "Running examples in directory $dir"
  echo "Running examples in directory $dir"   >> $ST_DIR/run_ex.log
  echo " "
  echo t_*  >f_list
  read list < f_list
  for x in $list
    do
       echo "Starting example $x" 
       ./$x  
       echo "Example $x completed with exit code $?" 
       echo " "
    done
  rm f_list
  cd $ST_DIR
  echo " "                                    >> $ST_DIR/run_ex.log
done
