![](https://seccdn.libravatar.org/avatar/27023f5ba9c8e122060340126d06642c.jpg?s=120&d=mm&r=g)
Hi opensuse-de! On Do, 03 Sep 2009, Christian Brabandt wrote: Da war wohl noch ein Fehler vom Test drin. Das Skript braucht sich ja gar nicht mehr selbst aufrufen. Am besten die letzte If-Bedingung rauswerfen, dann sollte es so aussehen:
,---- | #!/bin/bash | | help() { | cat <<EOF | `basename $0` Datum | | `basename $0` berechnet die laufende Woche eines Monats. | Das Datum muß im Format "MM/TT/YYYY" vorliegen. | EOF | exit 1 | } | | | if [ "$#" -ne 1 ]; then | run=0 | fi | | # Bei Fehlern auskommentieren und | # untere case Anweisung nutzen: | if [[ "$1" =~ [[:digit:]]{1,2}/[[:digit:]]{1,2}/[[:digit:]]{4} ]]; then | run=1 | else | run=0 | fi | | # Falls die bash =~ noch nicht unterstüzt, kann man obiges auch | # mit case ausdrücken | # (ohne Prüfung auf Ziffern): | #case "$1" in | #??/??/????) run=1 ;; | #?/??/????) run=1 ;; | #?/?/????) run=1 ;; | #??/?/????) run=1 ;; | #*) run=0 ;; | #esac | | if [ $run -eq 0 ]; then | help | fi | | | IFS='/' | set -- $1 | | monat="$1" | tag="$2" | jahr="$3" | | | f_day_month="$(date -d "$monat"/01/"$jahr")" | | let "first_week = 10#"$(date -d"$f_day_month" '+%W')"" | | if [ "$first_week" = "53" ]; then | first_week = 1 | fi | | let "cur_week = 10#"$(date -d"$monat"/"$tag"/"$jahr" '+%W')"" | | week="$(($cur_week - $first_week + 1))" | | echo $week `----
(Fehler könnten trotzdem noch drin sein ;) Mit freundlichen Grüßen Christian -- So when I saw the post to comp.editors, I rushed over to the FTP site to grab it. So I yank apart the tarball, light x candles, where x= the vim version multiplied by the md5sum of the source divided by the MAC of my NIC (8A3FA78155A8A1D346C3C4A), put on black robes, dim the lights, wave a dead chicken over the hard drive, and summon the power of GNU GCC with the magic words "make config ; make!". [Jason Spence, compiling Vim 5.0] -- Um die Liste abzubestellen, schicken Sie eine Mail an: opensuse-de+unsubscribe@opensuse.org Um eine Liste aller verfuegbaren Kommandos zu bekommen, schicken Sie eine Mail an: opensuse-de+help@opensuse.org