summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xgod/licht33
1 files changed, 19 insertions, 14 deletions
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 <lampe> <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 <lampe> <0/1>"
+ else
+ echo "Toggle light $LAMPE ($TOGGLE)"
+ echo -ne "$STRING" | nc -u -w1 licht.shack 1337
+ fi
+ ;;
+esac