From 92ab76da4f84070e0da74ba7bc91b19941fad3c6 Mon Sep 17 00:00:00 2001 From: root Date: Thu, 25 Aug 2011 21:50:14 +0200 Subject: Workz now --- god/licht | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100755 god/licht (limited to 'god') diff --git a/god/licht b/god/licht new file mode 100755 index 00000000..2b05b9f3 --- /dev/null +++ b/god/licht @@ -0,0 +1,15 @@ +#!/bin/bash +LAMPE=`echo $1 | sed -n '/^[1-2]*[0-9]*[0-9]$/p' | xargs echo "obase=16;" | bc` +TOGGLE=`echo $2 | sed -n '/^[0-1]$/p'` +if ! [ "$LAMPE" -a "$TOGGLE" ];then + echo "you are made of stupid" + exit 1 +fi +STRING="\xA5\x5A\x$LAMPE\x$TOGGLE" +if [ $# != 2 ] +then + echo -ne "Usage: licht <0/1>" +else + echo "$LAMPE$TOGGLE" + echo -ne "$STRING" | nc -u -w1 licht.shack 1337 +fi -- cgit v1.2.3 From 27253e631bc6730278234ae3b2b3ba4aff87be49 Mon Sep 17 00:00:00 2001 From: root Date: Thu, 25 Aug 2011 22:32:13 +0200 Subject: Added help --- god/licht | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) (limited to 'god') diff --git a/god/licht b/god/licht index 2b05b9f3..8ece3510 100755 --- a/god/licht +++ b/god/licht @@ -1,15 +1,20 @@ #!/bin/bash -LAMPE=`echo $1 | sed -n '/^[1-2]*[0-9]*[0-9]$/p' | xargs echo "obase=16;" | bc` -TOGGLE=`echo $2 | sed -n '/^[0-1]$/p'` -if ! [ "$LAMPE" -a "$TOGGLE" ];then - echo "you are made of stupid" - exit 1 -fi -STRING="\xA5\x5A\x$LAMPE\x$TOGGLE" -if [ $# != 2 ] -then - echo -ne "Usage: licht <0/1>" -else - echo "$LAMPE$TOGGLE" - echo -ne "$STRING" | nc -u -w1 licht.shack 1337 -fi +case "$1" in + (--help) echo "Toggle the lights";; + (*) + LAMPE=`echo $1 | sed -n '/^[1-2]*[0-9]*[0-9]$/p' | xargs echo "obase=16;" | bc` + TOGGLE=`echo $2 | sed -n '/^[0-1]/p'` + if ! [ "$LAMPE" -a "$TOGGLE" ];then + echo "you are made of stupid" + exit 1 + fi + STRING="\xA5\x5A\x$LAMPE\x$TOGGLE" + if [ $# != 2 ] + then + echo -ne "Usage: licht <0/1>" + else + echo "Toggle light $LAMPE ($TOGGLE)" + echo -ne "$STRING" | nc -u -w1 licht.shack 1337 + fi + ;; +esac -- cgit v1.2.3