advent2020/first

12 lines
271 B
Bash
Executable File

#!/bin/bash
if [[ $# = 1 ]]; then
day=$1
else
day="$(date +%d | sed 's/^0//')"
fi
read -r answer < <(tail -n 1)
curl -D - "https://adventofcode.com/2020/day/$day/answer" -H "Cookie: session=$(cat cookie)" --data-raw "level=1&answer=$answer" | grep '<article>'