#! /bin/bash coin="$@" REMOTE_NAME="blaster" say="/usr/bin/logger -p info -t mythchannel" user="mythtv" pass="mythpassword" flip_it() { for digit in $(echo $score | sed -e 's/./& /g'); do irsend SEND_ONCE $REMOTE_NAME "$digit" $say "`date` coin is $coin, score is $score, digit is $digit" done sleep 2 } if [ -z "$coin" ] then RET="1" else bb="`echo " mysql -u $user -p $pass -Ee 'select channum from channel where freqid="$coin" ' mythconverg"`" [ ! -z "$bb" ] && score="`(echo "$bb")| sh|grep channum|awk {'print $2'}`" fi if [ -z "$score" ] then RET="1" else flip_it RET="0" fi exit $RET