1#!/usr/local/bin/bash
2
3# Make sure that Dakota passes ONLY the results file name. If it passes
4# the wrong thing, touch FAIL to force the workflow to FAIL
5
6
7if [ $# -ne 1 ]  # don't know the name of the results file
8then
9  exit -1
10fi
11
12# Stem of file is correct
13results=$1
14if [ "${results:0:6}" != "tb.out" ]
15then
16  echo FAIL > $results
17  exit -1
18fi
19
20# Tag exists
21re='^[0-9]+$'
22rtag=${results:7}
23if ! [[ "$rtag" =~ $re ]]
24then
25  echo FAIL > $results
26  exit -1
27fi
28
29
30if [ -f FAIL ]
31then
32  echo FAIL > $results
33  exit
34fi
35
36mv tempresults.out $results
37