I have script as shown below. Q can be 1, 3 or 6. So like so 1 = E, 3 = R and 6 = S. So, when I get to sending to serial port, Q should be E, R or S. I'm totally stuck. Any help?
touch $logfile
echo "file = $file"
# Split the fields into the Ademco/SIA ContactID fields
MT=`echo $EVENT | cut -b5-6`
ACCT=`echo $EVENT | cut -b1-4`
#MT=`echo $EVENT | cut -b5-6`
Q=`echo $EVENT | cut -b7`
XYZ=`echo $EVENT | cut -b8-10`
GG=`echo $EVENT | cut -b11-12`
CCC=`echo $EVENT | cut -b13-15`
S=`echo $EVENT | cut -b16`
###############################################################################
# Start Logging
################################################################################
echo "================================================================================" >> $logfile
echo " Alarm Notification received at `date`" >> $logfile
echo "============================================================================ ====" >> $logfile
echo Alarm String was $EVENT >> $logfile
echo Account Number $ACCT >> $logfile
echo Message Type $MT >> $logfile
echo Event Qualifier $Q >> $logfile
echo Event Code $XYZ >> $logfile
echo Group $GG >> $logfile
echo Zone $CCC >> $logfile
echo Checksum $S >> $logfile
echo "" >> $logfile
echo 5012 $MT$ACCT$Q$XYZ$GG$CCC'\024\r' >> /dev/ttyAMA0
echo 5012 $MT$ACCT$Q$XYZ$GG$CCC >> /home/monitoring/pinCaptur/signals.txt