greetings,
the goal below is to test the supplied options/arguments for validity. if the matlab option is not supplied with the additional option of a file then exit. however if matlab IS supplied with its companion option of a file OR batch is the only option then continue on. it's clear the -a -n thing isn't working correctly. hopefully i've explained it well enough and the code below at least conveys my intention. any insight would be appreciated.
if [ "$CODE" = "comsol" ]; then
if [ "$PASS_OPTS" = " matlab" ] && [ -z "$PASS_OPTS2" ]; then
Fatal "You must use --opts matlab --opts2 filename.m"
else
if [ "$PASS_OPTS" = " matlab" -a -n "PASS_OPTS2" ] || [ "$PASS_OPTS" = " batch" ]; then
case "$CPUS" in
( 12|24|36 )
export AMT=$(expr $CPUS / 12)
RUSAGE="rusage[lic_req_comsol=1:duration=15]"
;;
( * )
echo ""
Fatal "You must either specify 12, 24 or 36 cpus for code Comsol"
;;
esac
fi
fi
fi