#!/bin/bash

# ----------------------------------------------------------------
# RPC Project :
# Run RPC_create simulated data of an imaginary search-coil,
#                                  an imaginary magnetometer
#                              and an imaginary trajectory
#
#     P. Robert, ScientiDev, Feb. 2021
# ----------------------------------------------------------------

appli=`basename $0`
appli36=`echo "$appli                                 " | cut -c1-36`
Narg=1
echo " -------------------------------------------------------------------"
echo $appli $*

if( (test $# = 1 ) && (test $1 = -h ) ) ; then hh=1 ; else hh=0 ; fi

if test $# != $Narg || test $hh = 1
   then
    # On n'a pas le bon nombre d'arguments ou on demande un "help"
   echo 
   echo "$appli : create simulated data of ULF, MAG and POS data"
   echo "$appli   require $Narg argument(s), ex:"
   echo "$appli   ULF   (or MAG or POS)"
   echo ""
 if test $hh = 1 ; then exit 0 ; fi
   echo "$appli36 : *** ERROR ! Command aborted." >&2
   exit 1
fi

datim1=`date +%F'  '%H':'%M':'%S `
julsec1=`date +%s`

# remove RPC_ from RPC command

appli=`echo $appli | cut -c5-`

echo $1 > $appli.in

# run appli.exe 

. run_appli.bash $appli
err=$?
exit $err
