#!/bin/bash port=/dev/ttyUSB0 cmdfile=~/annunciatorServer.txt ## Setup serial port stty -F $port ispeed 9600 ospeed 9600 -ignpar cs8 -cstopb -hupcl ## Setup files touch $cmdfile ## Monitor file for new commands while true do incmd=$(head -c 1 $cmdfile) if [ _$incmd != _ ] then echo $incmd > $port > $cmdfile fi sleep 1 done