Skip to content

Instantly share code, notes, and snippets.

@x4x
Created February 7, 2018 09:46
Show Gist options
  • Save x4x/54322d53b294581ba891223b517d20ba to your computer and use it in GitHub Desktop.
Save x4x/54322d53b294581ba891223b517d20ba to your computer and use it in GitHub Desktop.
Test for EVA700 Bayern/Hessen Network Protokoll
#!/bin/bash
# test for EVA700 Bayern/Hessen Protokoll
usage="$(basename "$0") [-h] [-c n] -- Bayern/Hessen Protokoll network test.\n
\n
where:\n
-h show this help text\n
-c run for number of counts"
# get parameters
while getopts c:h: option
do
case "${option}"
in
c) COUNT=${OPTARG};;
h) echo -e $usage; exit;;
esac
done
# remove optaind parameters
shift $((OPTIND-1))
IP=$1
PORT=$2
#for (( ; ; ))
for (( c=0; c<=$((COUNT)); c++ ))
do
#echo $((c));
# if count 0 run infenete
if [ $((COUNT)) == 0 ]
then
c=-2
fi
echo -ne '\x02\x44\x41\x03\x30\x34' | nc $IP $PORT | sed -e "s/ 034 /\x1b[32m 034 \x1b[0m/g" -e "s/ 033 /\x1b[32m 033 \x1b[0m/g";
echo -ne '\n';
sleep 2;
done;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment