
 
if(test -r LOCK) then
  cat LOCK
  echo "Remove LOCK file, in order to start CalcHEP anyway"   
  exit
fi

echo "CalcHEP is already started here, process number $$" > LOCK

trap "rm LOCK" 0 1 2 3

while :
do 
  $CALCHEP/s_calchep
  case $? in 
    13) ;;
    24)  $CALCHEP/s_calchep -blind "]}}]]]}9" 
         cd results 
         $CALCHEP/nCompil 1>/dev/null 2>/dev/null
         $CALCHEP/ld_n 
         cd ..
        break;;
    *)
      break 
  esac 
done 

echo 'End of CalcHEP session.'
