#!/bin/bash PARENT_DIR=$(dirname $PWD) YEAR=${PARENT_DIR##*/} DAY_RAW=${PWD##*/} DAY=$((10#$DAY_RAW)) SESSION_KEY=$(cat ~/.aocrc) echo "Fetching ${YEAR} ${DAY}" echo $SESSION_KEY curl -b session=$SESSION_KEY https://adventofcode.com/${YEAR}/day/${DAY}/input > input echo "Visit: https://adventofcode.com/${YEAR}/day/${DAY}"