#!/bin/bash # Connect TCP socket to 127.0.0.1 port 1099 on handle 6. exec 6<>/dev/tcp/127.0.0.1/1099 currentHCUC="unknown" while read <&6 do # Show the line on standard output just for debugging. echo $REPLY >&1 case $REPLY in *Rx\ PL\ HouseUnit:\ B6*) currentHCUC="B6" ;; *Rx\ PL\ House:\ B*On*) if [ "$currentHCUC" = "B6" ] then echo "pl a6 on" >&6 fi ;; *Rx\ PL\ House:\ B*Off*) if [ "$currentHCUC" = "B6" ] then echo "pl a6 off" >&6 fi ;; esac done