summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorroot <root@krebs>2011-08-25 22:32:13 +0200
committerroot <root@krebs>2011-08-25 22:32:13 +0200
commit27253e631bc6730278234ae3b2b3ba4aff87be49 (patch)
tree4e48c693402852a69da8ed9619135f3dba18fb60
parent92ab76da4f84070e0da74ba7bc91b19941fad3c6 (diff)
Added help
-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