X-Git-Url: https://www.fi.muni.cz/~kas/git//home/kas/public_html/git/?a=blobdiff_plain;f=get.sh;h=f888a90c65bb88069eb952d69a5e87d3af5d20e5;hb=HEAD;hp=a0d03f809344ade833b8c2ada9fb6018fc2fc42e;hpb=50e9ae670d01536489c1651b11aa1cf040bd95eb;p=aoc2021.git diff --git a/get.sh b/get.sh index a0d03f8..f888a90 100755 --- a/get.sh +++ b/get.sh @@ -4,6 +4,25 @@ DAY=`date +%e|sed 's/ //g'` FILE="$((2*DAY - 1))in.txt" COOKIE=`cat cookie` +START="6:00:02" +MAXWAIT=300 +STARTSEC=`date -d "$START" "+%s"` +NOW=`date "+%s"` +WAITSEC=`expr $STARTSEC - $NOW` + +if [ $WAITSEC -gt 0 -a $WAITSEC -lt $MAXWAIT ] +then + echo "Waiting for $WAITSEC seconds till $START for getting $FILE ..." + sleep $WAITSEC +fi + URL="https://adventofcode.com/2021/day/$DAY/input" -echo "Stahuji $URL do $FILE" -curl -q -b "$COOKIE" "$URL" --output "$FILE" +echo +echo "Downloading $URL to $FILE" +curl -s -b "$COOKIE" "$URL" --output "$FILE" +echo ======================================================================== +cat "$FILE" +echo ======================================================================== +echo "lines words chars" +wc "$FILE" +echo