#!/bin/sh

bad=1

caput $1:TGTINSTALLED $2
echo $1:TGTINSTALLED $2
caput $1:FLT1INSTALLED $3
echo $1:FLT1INSTALLED $3
caput $1:FLT2INSTALLED $4
echo $1:FLT2INSTALLED $4
caput $1:TLAMPINSTALLED $5
echo $1:TLAMPINSTALLED $5
caput $1:GLAMPINSTALLED $6
echo $1:GLAMPINSTALLED $6
caput $1:MTRINSTALLED $7
echo $1:MTRINSTALLED $7

if [ $8 -eq $bad ]
then
    echo Filter 1 is swapped
    caput $1:FLT1_CTRL.ZNAM "In";
    caput $1:FLT1_CTRL.ONAM "Out";
    caput $1:FLT1_STS_CALC.INPA "$1:FLT1_OUT"
    caput $1:FLT1_STS_CALC.INPB "$1:FLT1_IN"
    echo Filter 1 fixed
else
    echo Filter 1 good
fi

if [ $9 -eq $bad ] 
then
    echo Filter 2 is swapped
    caput $1:FLT2_CTRL.ZNAM "In"
    caput $1:FLT2_CTRL.ONAM "Out"
    caput $1:FLT2_STS_CALC.INPA "$1:FLT2_OUT"
    caput $1:FLT2_STS_CALC.INPB "$1:FLT2_IN"
    echo Filter 2 fixed
else
    echo Filter 2 good
fi

#End of script
