diff options
author | root <root@krebs> | 2011-08-25 22:32:13 +0200 |
---|---|---|
committer | root <root@krebs> | 2011-08-25 22:32:13 +0200 |
commit | 27253e631bc6730278234ae3b2b3ba4aff87be49 (patch) | |
tree | 4e48c693402852a69da8ed9619135f3dba18fb60 | |
parent | 92ab76da4f84070e0da74ba7bc91b19941fad3c6 (diff) |
Added help
-rwxr-xr-x | god/licht | 33 |
1 files changed, 19 insertions, 14 deletions
@@ -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 |