#!/bin/bash
# Start Mathematica in batch mode and start the initialisation script
# Rok Zitko, rok.zitko@ijs.si, Aug 2009

# Determine where the nrginitscript is located (by following soft links if
# necessary).

SCRIPT_PATH="${BASH_SOURCE[0]}";
if([ -h "${SCRIPT_PATH}" ]) then
  while([ -h "${SCRIPT_PATH}" ]) do SCRIPT_PATH=`readlink "${SCRIPT_PATH}"`; done
fi
pushd . > /dev/null
cd `dirname ${SCRIPT_PATH}` > /dev/null
SCRIPT_PATH=`pwd`;
popd  > /dev/null

NRG_INITSCRIPT=${SCRIPT_PATH}/nrginit.m
MATH=math
$MATH -batchinput -batchoutput <${NRG_INITSCRIPT}
