From: Jan "Yenya" Kasprzak Date: Wed, 8 Dec 2021 06:50:03 +0000 (+0100) Subject: get.sh: better output, auto wait, input stats X-Git-Url: https://www.fi.muni.cz/~kas/git//home/kas/public_html/git/?p=aoc2021.git;a=commitdiff_plain;h=4e1986293b6f8ff1893dad78013b1d93dd346f64 get.sh: better output, auto wait, input stats --- diff --git a/get.sh b/get.sh index a0d03f8..e5b394d 100755 --- a/get.sh +++ b/get.sh @@ -4,6 +4,23 @@ 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 ..." + 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 +echo "lines words chars" +wc "$FILE" +echo