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 | 2b67a2d2f99f537901fb5b354462dc0e62ac6809 (patch) | |
tree | 56403b72975d7b98368d469d60d3c1c1ffad0727 /god/licht | |
parent | bca44610df5de4543c3d86e916e45a5ca05544bf (diff) |
Added help
Diffstat (limited to 'god/licht')
-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 |