Skip to content

Instantly share code, notes, and snippets.

@JMatthewman
Created May 13, 2013 01:10
Show Gist options
  • Save JMatthewman/5565595 to your computer and use it in GitHub Desktop.
Save JMatthewman/5565595 to your computer and use it in GitHub Desktop.
#!/bin/bash
if [ $# -lt 3 ]
then
echo "Useage: [string] [loops] [interval]"
else
STRING=$1
COUNTER=$2
INTERVAL=$3
if [ "$(screen -ls | grep TS3client)" == "" ]
then
screen -A -m -d -S TS3name telnet 192.168.0.100 25639;
sleep 0.5;
fi
if [ $STRING == "COUNT" ]
then
while [ $COUNTER -gt 0 ]
do
screen -x TS3name -p 0 -X stuff "sendtextmessage targetmode=2 msg="$COUNTER"$(echo -ne '\r')"
COUNTER=$(( $COUNTER - 1 ))
sleep $INTERVAL
done
exit
fi
while [ $COUNTER -gt 0 ]
do
screen -x TS3name -p 0 -X stuff "sendtextmessage targetmode=2 msg="$STRING"$(echo -ne '\r')"
COUNTER=$(( $COUNTER - 1 ))
sleep $INTERVAL
done
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment