
if test $# != 5
then
   echo "Absorbance Correction for an IR spectral image."
   echo "Usage:"
   echo "  absIR.ksh irTemplate bgTemplate outDir outTemplate bgScale"
   echo "Example:"
   echo " absIR,ksh sil_ft/ir%03d.dat bak_ft/ir%03d.dat sil_abs ir%03d.dat 1.0"
   exit 0
fi

specName=$(echo $1 | sed -e 's/%03d/%03.0f/')
bgName=$(echo $2 | sed -e 's/%03d/%03.0f/')
outDir=$3
outName=$(echo $4 | sed -e 's/%03d/%03.0f/')
scale=$5

if (test -e $outDir) && !(test -d $outDir)
then
   echo "abs.ksh error: $outDir exists, but is not a directory."
   exit 1
fi

if !(test -d $outDir)
then
   mkdir $outDir
fi

M $NMRTXT/absIR.M -var scale $scale \
   -str specName $specName bgName $bgName outName $outDir/$outName -quit
