#!/bin/sh year=2024 if [ ! $# -eq 1 ] then echo "Usage: $0 " exit 1 fi day=$1 cookiefile=${3:-'./cookie'} dir=$(printf "day%02d" $day) echo "Initializing directory $dir/" rsync -av --ignore-existing skel/ ${dir}/ advent_session=$(cat $cookiefile 2> /dev/null) && echo "Downloading input ..." && curl "https://adventofcode.com/$year/day/$day/input" \ -H "Cookie: session=$advent_session" > $dir/input.txt