#! /bin/sh
#
# This script should not need to be run directly,
# but will be automatically executed via "sympow_bin -new_data []"
#
# example direct usages
# sh new_data /bin/sh /usr/bin/gp '-sp 3 -dv 2'
# sh new_data /bin/sh /usr/bin/gp '-cm -sp 4'
# sh new_data /bin/sh /usr/bin/gp '-sp 2'
# sh new_data /bin/sh /usr/bin/gp '-hecke -sp 3 -dv 1'

if [ $# != 3 ];
then
echo "**ERROR**: Wrong number of input parameters"; exit;
fi

echo "Running the new_data script for $3"

SH=$1 && GP=$2
echo "Making the datafiles for $3" && echo "" &&
sympow_bin -rewarp && sympow_bin -shell1 "$3" &&
sympow_bin -shell1 "$3" | $SH &&
echo 'Running the gp script' && echo "" &&
sympow_bin -pari "$3" &&
sympow_bin -pari "$3" | $GP -q > /dev/null && echo "" &&
sympow_bin -shell2 "$3" &&
sympow_bin -shell2 "$3" | $SH &&
sympow_bin -rewarp && echo "Finished with $3"
