summaryrefslogtreecommitdiffstats
path: root/god/licht
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
commit2b67a2d2f99f537901fb5b354462dc0e62ac6809 (patch)
tree56403b72975d7b98368d469d60d3c1c1ffad0727 /god/licht
parentbca44610df5de4543c3d86e916e45a5ca05544bf (diff)
Added help
Diffstat (limited to 'god/licht')
-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