aboutsummaryrefslogtreecommitdiff
path: root/m/runmath.sh
blob: 306b2e1faf273a357eeaf57758f6fabaa3ebbb03 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#! /bin/bash

# Abort on errors
set -e

MATHEMATICA="math"

script=$1

if test -z "$script"; then
    echo "Usage:"
    echo "$0 <script.m>"
    exit 2
fi

error=$(basename $script .m).err
output=$(basename $script .m).out

rm -f $output

# Run Mathematica to regenerate the code
< $script "$MATHEMATICA" | tee $error

if grep 'KrancError' $error; then
    echo
    echo "There was an error when running Kranc on $script."
    echo "The file $error contains details."
    echo
    echo "*** The Cactus thorns have NOT been updated. ***"
    echo
    exit 1
fi

mv $error $output