#!/bin/bash --norc
#
# TITLE: edmRun
# INVOCATION: edmRun display <macro_arg>
# Argument1: edm display filename with optional .edl extension 
# Argument2: optional macro argument expansion <macro_arg>
# 
# Executable bash script to run edm with the display filename as an argument.
#
# Source $EPICS/script/epicsReset.bash here
#  to establish the common environment. 
#  Above sets $EDMDATAFILES=$EPICS/edm/display + paths to slc-aware displays
#  Above places /afs/slac/g/lcls/tools/script in $PATH

source /afs/slac/g/lcls/epics/config/epicsReset.bash

# Position to NFS so that any data files written by EDM go into NFS 
# so no need to worry about AFS tokens.
cd $EDM_DATA

#echo $EDMDATAFILES

#echo Num args: $#
#echo First arg: $1
#echo Second arg: $2
if [ $# -eq	1 ]; then
   #echo Exceuting edm
   edm -x $1 &	
else	
   #echo Executing edm macro line
   edm -x -m "IOC=$2" $1 &
fi
#end of script
